summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-12 20:47:02 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-12 20:48:57 -0700
commitbd0f2f3e0fe721c7fbce63aeacffaec8344e166c (patch)
tree0fa494fa06ca00e72926a6bde8158adb0ddc5a06
parent17f3801f416e8d22ecdf8b88516d7d3876cd0643 (diff)
stack.c.gen: Allow multiples of a thread
-rwxr-xr-xbuild-aux/stack.c.gen29
1 files changed, 18 insertions, 11 deletions
diff --git a/build-aux/stack.c.gen b/build-aux/stack.c.gen
index cde6a1e..af5d740 100755
--- a/build-aux/stack.c.gen
+++ b/build-aux/stack.c.gen
@@ -135,7 +135,7 @@ def analyze(
*,
ci_fnames: list[str],
extra_nodes: list[Node] = [],
- app_func_filters: dict[str, typing.Callable[[str], bool]],
+ app_func_filters: dict[str, typing.Callable[[str], int]],
app_location_xform: typing.Callable[[str], str],
app_indirect_callees: typing.Callable[[VCGElem], list[str]],
app_skip_call: typing.Callable[[list[str], str], bool],
@@ -289,12 +289,12 @@ def analyze(
nsum = 0
rows: dict[str, int] = {}
for funcname in graph:
- if grp_filter(funcname):
+ if cnt := grp_filter(funcname):
n = nstatic(funcname)
rows[app_location_xform(funcname)] = n
if n > nmax:
nmax = n
- nsum += n
+ nsum += cnt * n
# Figure sizes.
namelen = max([len(k) for k in rows.keys()] + [len(grp_name) + 4])
@@ -431,9 +431,14 @@ def main(
hooks_indirect_callees += [sbc_indirect_callees]
- def sbc_is_thread(name: str) -> bool:
+ def sbc_is_thread(name: str) -> int:
if name.endswith("_cr") and name != "lib9p_srv_read_cr":
- return True
+ if "9p" in name:
+ if "read" in name:
+ return 8
+ elif "write" in name:
+ return 16
+ return 1
if name == "main":
return True
return False
@@ -768,18 +773,20 @@ def main(
# Tie it all together ############################################
- def thread_filter(name: str) -> bool:
+ def thread_filter(name: str) -> int:
return sbc_is_thread(name)
- def intrhandler_filter(name: str) -> bool:
+ def intrhandler_filter(name: str) -> int:
name = name.rsplit(":", 1)[-1]
for hook in hooks_is_intrhandler:
if hook(name):
- return True
- return False
+ return 1
+ return 0
- def misc_filter(name: str) -> bool:
- return name.endswith(":__lm_printf") or name == "__assert_msg_fail"
+ def misc_filter(name: str) -> int:
+ if name.endswith(":__lm_printf") or name == "__assert_msg_fail":
+ return 1
+ return 0
def location_xform(loc: str) -> str:
if not loc.startswith("/"):