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 gvanrossum
Recipients eric.araujo, gvanrossum
Date 2013-02-09.00:16:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360368978.08.0.916375749369.issue17130@psf.upfronthosting.co.za>
In-reply-to
Content
While we're on profile convenience features, how about adding two context managers:

- one that just profiles a block and prints the profile (or dumps the data to a file)

- one that takes a Profile instance and enables profiling to that instance

E.g. (1)

with cProfile.runblock([file]):
    <your code here>

or (2)

p = cProfile.Profile()
with p:
    <your code here>

Also a decorator corresponding to (1):

@cProfile.runfunc([filename])
def myfunc(args):
    <stuff>
History
Date User Action Args
2013-02-09 00:16:18gvanrossumsetrecipients: + gvanrossum, eric.araujo
2013-02-09 00:16:18gvanrossumsetmessageid: <1360368978.08.0.916375749369.issue17130@psf.upfronthosting.co.za>
2013-02-09 00:16:18gvanrossumlinkissue17130 messages
2013-02-09 00:16:17gvanrossumcreate