gak / pycallgraph

pycallgraph is a Python module that creates call graphs for Python programs.
GNU General Public License v2.0
1.82k stars 336 forks source link

Add time fraction filtering #162

Open campos-ddc opened 8 years ago

campos-ddc commented 8 years ago

Add an option to only show nodes that contribute to a certain fraction of the total runtime. For example: pycallgraph --min-fraction=0.05 (Only show nodes that have >5% of total runtime)

Most of the times I am profiling something, I am interested in finding the large culprits, and graphs quickly become too large for any medium-sized project due to thousands of function calls that only add up to 0.0001% of the runtime.

With some quick hacking of the source code I tested filtering nodes based on node.time.fraction (and also filtering edges / groups to not show unless they have relevant nodes). This was the only way I was able to generate a graph for my project, that failed with 2mb dot files even with max-depth at a low 4.