This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients collinwinter, giampaolo.rodola, pitrou
Date 2010-07-17.14:01:08
SpamBayes Score 0.00026593098
Marked as misclassified No
Message-id <1279375274.49.0.102313390752.issue9285@psf.upfronthosting.co.za>
In-reply-to
Content
A patch including tests is in attachment.
Example usage:

>>> from cProfile import profile
>>>
>>> @profile
... def factorial(n):
...     n = abs(int(n))
...     if n < 1: 
...             n = 1
...     x = 1
...     for i in range(1, n+1):
...             x = i * x
...     return x
... 
>>>
>>> factorial(5)
    Thu Jul 15 20:58:21 2010    /tmp/tmpIDejr5

             4 function calls in 0.000 CPU seconds

       Ordered by: internal time, call count

       ncalls  tottime  percall  cumtime  percall filename:lineno(function)
            1    0.000    0.000    0.000    0.000 profiler.py:120(factorial)
            1    0.000    0.000    0.000    0.000 {range}
            1    0.000    0.000    0.000    0.000 {abs}
            1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}

120
>>>


Before including doc changes I'd like to hear whether this is actually desirable or not.
History
Date User Action Args
2010-07-17 14:01:14giampaolo.rodolasetrecipients: + giampaolo.rodola, collinwinter, pitrou
2010-07-17 14:01:14giampaolo.rodolasetmessageid: <1279375274.49.0.102313390752.issue9285@psf.upfronthosting.co.za>
2010-07-17 14:01:10giampaolo.rodolalinkissue9285 messages
2010-07-17 14:01:10giampaolo.rodolacreate