summaryrefslogtreecommitdiff
path: root/anim/tools/chart.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 13:22:07 -0300
committerGabriel Schneider <[email protected]>2026-11-11 13:26:44 -0300
commit2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c (patch)
tree140a291011e453888ed87b7a43d75f538abb9fae /anim/tools/chart.py
parent576a78b4de02c4c6566c327d85c465554d293975 (diff)
downloadcomputeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.tar.gz
computeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.zip
canim: the graph of a function's blocks
From the user. A blocks lens draws a function's basic blocks as boxes with their offsets and visit counts, loops in their lanes with the turn count, the path's last edges gold, the pc's block gold, and the disassembly as its view; leave and turn carry the mark along an edge, with the compare's flags framed for the edge chosen. On the map the graph takes the disassembly's place with its rows. The layout is a pure function, tested on sort, reverse and libc's open (twelve blocks the run never reached fold into six boxes). The sort scene walks one trip of its inner loop block by block and sprints the middle on the map. Every scene's linear rows carry a rule and a count at each block's head. The stack's panel no longer reads registers from the file on every draw: a frame is 20 ms where it was 57. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/tools/chart.py')
-rw-r--r--anim/tools/chart.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/anim/tools/chart.py b/anim/tools/chart.py
index 1384800..7cc0925 100644
--- a/anim/tools/chart.py
+++ b/anim/tools/chart.py
@@ -45,9 +45,13 @@ def split(drawing, view, source, disasm, slots, backtrace=0):
# and the run's step counter (912 to 934).
words = {"clock": (0, 888, 1656, 46), "caption": (0, 940, 1464, 140), "minimap": (1664, 912, 192, 108)}
none, beside, subject = split(0, 0, 14, 17, 8, 4), split(152, 152, 8, 17, 8), split(296, 200, 10, 9, 6)
+# The `blocks` lens: the graph over the program column, the source alone under it; the disassembly
+# (its view) over the state column, seven rows, the registers and six words under it.
+blocks = {**subject, "view": (976, 48, 880, ph(7)), "source": (64, 356, 880, ph(20))}
+del blocks["disasm"]
motion.REGIONS.update({
"fib": {**subject, **words},
- "sort": {**subject, **words},
+ "sort": {**blocks, **words},
# The band is the calls so far; the disassembly a descent.
"syscalls": {**beside, **words},
"heap": {**subject, **words},
@@ -57,9 +61,9 @@ motion.REGIONS.update({
"zoom": {**none, **words},
"gallery": {**beside, **words},
})
-# `cut`: the gallery is the catalogue's pages, cut from one to the next (scenes/gallery.zig: 3, 6, 9.6, 13, 16 and
-# 19.8 s), not a scene: a page's first frame changes everything at once by design.
-PAGES = {180, 360, 576, 780, 960, 1188}
+# `cut`: the gallery is the catalogue's pages, cut from one to the next (scenes/gallery.zig: 3, 6, 9.6, 13, 16,
+# 19.8, 21 and 24 s), not a scene: a page's first frame changes everything at once by design.
+PAGES = {180, 360, 576, 780, 960, 1188, 1260, 1440}
motion.EXEMPT["cut"] = lambda name, t, moved: lint.scene == "gallery" and any(abs(t - p) <= 1 for p in PAGES)
_regions_for = motion.regions_for
scene = lambda video: os.path.basename(video).split("-")[0].split(".")[0]