Profiler showing path dependency?

Barry Scott barry at barrys-emacs.org
Mon Mar 16 16:08:02 EDT 2020



> On 15 Mar 2020, at 21:05, Marco Sulla <Marco.Sulla.Python at gmail.com> wrote:
> 
> https://docs.python.org/3/library/profile.html#pstats.Stats.print_callers

And also look at print_callees. Between callers and callees you can
usually find some insight.

Barry


> 
> On Sat, 14 Mar 2020 at 00:54, Go Luhng <goluhng at gmail.com> wrote:
> 
>> Consider a simple call graph: `main()` calls `foo()`, which calls
>> `bar()`. Then `main()` calls `qux()` which also calls `bar()`, but
>> with different parameters.
>> 
>> When you run the above through cProfile and view the result in
>> SnakeViz, you will see `main()` calling `foo()` and `qux()`, with each
>> of them calling `bar()`. However, if you hover or click on `bar()`,
>> you will see the global aggregate statistics for it. For example, the
>> number of times it has been called, and their total time cost.
>> 
>> Is there a way to get a path-dependent profiler breakdown for `bar()`?
>> Specifically for this example, statistics for when it is called by
>> `foo()`, and separately statistics for when it is called by `qux()`.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list