You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tachyon’s --diff-flamegraph scales times in baseline run to duration of current run #154062
As discussed with @pablogsal during EuroPython sprints:
Using this simple example script (flamegraph_demo.py):
importtimedefmain():
f_1()
f_2()
deff_1():
time.sleep(0.5) # change this to 1.5 in the second rundeff_2():
time.sleep(1)
main()
python -m profiling.sampling run --binary -o baseline.bin flamegraph_demo.py
vim flamegraph_demo.py # edit f_1 to sleep for 1.5 s
python -m profiling.sampling run --diff-flamegraph baseline.bin -o diff.html flamegraph_demo.py
generates this diff flamegraph:
f_2 is unchanged between both runs, so the “Baseline Self” time should be equal to the “Current Self” and equal to 1 s (that it displays “1 ms” is covered in #154059); however, the baseline for all functions gets scaled with the ratio of total time in this run over total time of the previous run (in this case: 2.5 s / 1.5 s = 1.667).
I can imagine scenarios where this scaling is useful (e.g. when the baseline is generated on a different machine). However, in the common case of running baseline and diff on the same machine, this scaling means that a lot of unchanged functions get colour-coded, which distracts from the few functions that experienced a meaningful change.
Activity
pythongh-154062: Keep elided metadata in raw sample units
pythongh-154062: Stop normalizing differential flamegraph duration
pythongh-154062: Keep elided metadata in raw sample units
gh-154062: Stop normalizing differential flamegraph duration (#154082)
[3.15] gh-154062: Stop normalizing differential flamegraph duration (G…