Open codinglh opened 6 years ago
Interesting idea! With the sunburst visualization this wouldn't work, but with the icicle visualization this might be possible, I'll have to look into it sometime when I have time. Thanks for the suggestion!
Thanks for your reply! I'm very much looking forward the feature :)
This is a big gotcha when using threads (I can confirm thread trigger this weirdness now I'm not sure, but results are not good when threads are involved) or selective profiling:
I found this issue after seeing some to me very bizarre results (can't show them here) which prompted me to trying to understand closer what cProfile actually record - going through https://github.com/jiffyclub/snakeviz/issues/112 I arrived at this simple example which is an instance of this issue. (My original bizarre results are likely due to threading)
import time
def bar():
for i in range(4):
time.sleep(0.010)
def foo():
time.sleep(0.100)
bar()
bar()
bar()
def baz():
time.sleep(0.200)
bar()
with cProfile.Profile() as profiler:
foo()
baz()
profiler.dump_stats("/tmp/examplestats")
I'm a bit surprised with cProfile.Profile() as profiler:
doesn't end up creating a single root from the context manager, but apparently not.
A warning message when a profile has multiple root would be very helpful.
My project is an embbed python program. There are multiple python entry functions which are callbacked from c++. I found that in the "sv_find_root" function comment only one root node is reserved, this will cause error time statistics (like subfunction's cumtime more than parentfunction, etc.) and loose many information in the graph. Is't possible to support the multiple root node?