instrumenting Python code

Skip Montanaro skip at pobox.com
Wed Mar 27 20:46:32 EST 2002


    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()

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list