Profiler showing path dependency?

Marco Sulla Marco.Sulla.Python at gmail.com
Sun Mar 15 17:05:04 EDT 2020


https://docs.python.org/3/library/profile.html#pstats.Stats.print_callers

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
>


More information about the Python-list mailing list