classification
Title: cProfile incorrectly labels its output
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: exarkun, orsenthil
Priority: normal Keywords:

Created on 2010-11-09 19:15 by exarkun, last changed 2010-11-20 17:09 by orsenthil. This issue is now closed.

Messages (3)
msg120890 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2010-11-09 19:15
Consider this transcript:

>>> cProfile.run("import time; time.sleep(1)")
         4 function calls in 1.012 CPU seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.011    0.011    1.012    1.012 <string>:1(<module>)
        1    0.000    0.000    1.012    1.012 {built-in method exec}
        1    1.001    1.001    1.001    1.001 {built-in method sleep}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}


>>> 

It is not the case that the profiled code uses >1 CPU seconds.  It spends the entire time sleeping.  The default timer for cProfile is a wallclock timer.  The output should reflect this.
msg121101 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-11-13 01:18
On Tue, Nov 09, 2010 at 07:15:57PM +0000, Jean-Paul Calderone wrote:
> >>> cProfile.run("import time; time.sleep(1)")
>          4 function calls in 1.012 CPU seconds
> 
> It is not the case that the profiled code uses >1 CPU seconds.  It
> spends the entire time sleeping.  The default timer for cProfile is
> a wallclock timer.  The output should reflect this.

So, It should just be 1.012 seconds, instead of 1.012 CPU seconds. Correct?
Or is there any other technically more accurate way to say?
msg121685 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-11-20 17:09
Fixed in r86580 (py3k), r86581 and r86582.
History
Date User Action Args
2010-11-20 17:09:31orsenthilsetstatus: open -> closed

messages: + msg121685
resolution: fixed
components: + Library (Lib)
2010-11-13 01:18:06orsenthilsetnosy: + orsenthil
messages: + msg121101
2010-11-11 15:23:23eric.araujosetversions: - Python 2.6
2010-11-09 19:15:52exarkuncreate