tools/test: prof.py finds run.py's linemap in $TMPDIR (tempfile.mkdtemp), not only /tmp

This commit is contained in:
4DBug committed 2026-10-23 22:32:53 -05:00
1 parent 23e31fcf3c
commit 006c8c4a34
1 file changed
+2 -1
+2 -1
View File
@@ -2,7 +2,8 @@
# Summarise profile.out from `run.py --profile`: top functions by self and inclusive samples, mapped to source file lines
import collections, json, os, re, sys, glob
path = sys.argv[1] if len(sys.argv) > 1 else "profile.out"
tmp = max(glob.glob("/tmp/imgui_test_*/ImGui.linemap.json"), key=os.path.getmtime)
import tempfile # run.py uses tempfile.mkdtemp, i.e. $TMPDIR (not always /tmp)
tmp = max(glob.glob(os.path.join(tempfile.gettempdir(), "imgui_test_*/ImGui.linemap.json")) + glob.glob("/tmp/imgui_test_*/ImGui.linemap.json"), key=os.path.getmtime)
lm = json.load(open(tmp))
def loc(n):
if not n.isdigit(): return "C"