gschlossnagle / yappi

Automatically exported from code.google.com/p/yappi
MIT License
0 stars 0 forks source link

make yappi line-aware profiler #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I wish to do line-by-line profiling of  long running worker thread function?
2. How do I do it today?

I think this addition would make Yappi the ultimate profiler for Python apps. 
Many times, just getting the function name is not enough...specifically if the 
worker threads have big functions.

what would it take to make Yappi a line-by-line profier, i.e. add that 
functionality as a mode to Yappi.

Original issue reported on code.google.com by vsapr...@gmail.com on 21 Jul 2010 at 5:28

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
There is already a tool for that: http://pypi.python.org/pypi/line_profiler/
Integrating that functionality to Yappi seems to require enourmous effort that 
I seem not to have. However, I will leave this issue open as someone might want 
to volunteer.

Original comment by sum...@gmail.com on 28 Feb 2011 at 3:25

GoogleCodeExporter commented 8 years ago
I'd like to see this too, perhaps this could be done in a relatively simple 
way, change from
(file_name, function_name) => (count, time, ...) to
(file_name, function_name, line_number) => (count, time, ...)

as far as I understand line_profiler in the comment above is a deterministic 
profiler, while yappi is statistical profiler, there's a world of difference 
between the applicability of the two.

Original comment by dim...@gmail.com on 8 Aug 2012 at 2:20

GoogleCodeExporter commented 8 years ago
You are right about that they are two different applications with different use 
cases. However, yappi is not a statistical profiler, it exatcly determines each 
function entry/exit CPU time deterministically. 

I don't understand your comment on changing:
(file_name, function_name) => (count, time, ...) to
(file_name, function_name, line_number) => (count, time, ...)

You means the profiler statistics?

Original comment by sum...@gmail.com on 13 Dec 2012 at 10:07

GoogleCodeExporter commented 8 years ago
Currently yappi is deterministic function enter/exit profiler.
I would like to to be deterministic function and line profiler.
That is, if it is easy to implement, in addition to function entry/exit yappi 
could also count how many times a given line is executed.

For example I would like to recover stats like these:

def foo(x, y=1): return x*y  # called 5000 times

def loop():  # called 1 time
    for i in range(100):
       xxx = int("".join([...]))  # executed 100 times
       assert xxx == 10        # executed 100 times
       for x in range(xxx):
          yyy = int("".join([...])) # executed 1000 times
          assert yyy = 5           # executed 1000 times
          for y in range(yyy):
              foo(x, y)  # executed 5000 times (*)

I don't know if it is or is not easy to implement this in yappi.

Original comment by dim...@gmail.com on 13 Dec 2012 at 10:29

GoogleCodeExporter commented 8 years ago
 Adding line profiling functionality to yappi will require too much effort. Having simply another project dealing only with line-profiling is better instead of merging thast functionality to yappi itself. Yappi specializes on CPU/Wall clock time profiling  of long-running/possibly multithreaded Python applications.

Original comment by sum...@gmail.com on 25 Jun 2014 at 9:04

GoogleCodeExporter commented 8 years ago

Original comment by sum...@gmail.com on 25 Jun 2014 at 9:04