Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cProfile incorrectly labels its output #54586

Closed
exarkun mannequin opened this issue Nov 9, 2010 · 3 comments
Closed

cProfile incorrectly labels its output #54586

exarkun mannequin opened this issue Nov 9, 2010 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@exarkun
Copy link
Mannequin

exarkun mannequin commented Nov 9, 2010

BPO 10377
Nosy @orsenthil

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-11-20.17:09:31.101>
created_at = <Date 2010-11-09.19:15:52.340>
labels = ['type-bug', 'library']
title = 'cProfile incorrectly labels its output'
updated_at = <Date 2010-11-20.17:09:31.100>
user = 'https://bugs.python.org/exarkun'

bugs.python.org fields:

activity = <Date 2010-11-20.17:09:31.100>
actor = 'orsenthil'
assignee = 'none'
closed = True
closed_date = <Date 2010-11-20.17:09:31.101>
closer = 'orsenthil'
components = ['Library (Lib)']
creation = <Date 2010-11-09.19:15:52.340>
creator = 'exarkun'
dependencies = []
files = []
hgrepos = []
issue_num = 10377
keywords = []
message_count = 3.0
messages = ['120890', '121101', '121685']
nosy_count = 2.0
nosy_names = ['exarkun', 'orsenthil']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue10377'
versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

@exarkun
Copy link
Mannequin Author

exarkun mannequin commented Nov 9, 2010

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.

@exarkun exarkun mannequin added the type-bug An unexpected behavior, bug, or error label Nov 9, 2010
@orsenthil
Copy link
Member

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?

@orsenthil
Copy link
Member

Fixed in r86580 (py3k), r86581 and r86582.

@orsenthil orsenthil added the stdlib Python modules in the Lib dir label Nov 20, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant