instrumenting Python code

Bengt Richter bokr at oz.net
Wed Mar 27 22:31:45 EST 2002


On Wed, 27 Mar 2002 19:46:32 -0600, Skip Montanaro <skip at pobox.com> wrote:

>
>    Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
>    Type "help", "copyright", "credits" or "license" for more information.
>    >>> import hotshot
>    >>> hotshot.Stats
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>    AttributeError: 'module' object has no attribute 'Stats'
>
>My apologies.  I was typing from memory.  Should have been
>
>    import hotshot
>    profiler = hotshot.Profile("/home/skip/tmp/csv2csv.prof")
>    profiler.run("main()")
>    profiler.close()
>    import hotshot.stats
>    stats = hotshot.stats.load("/home/skip/tmp/csv2csv.prof")
>    stats.print_stats()
>
Thanks. That seems to work. Sorry to be lazy about it ;-/

Regards,
Bengt Richter





More information about the Python-list mailing list