== == Build and install == http://silassewell.googlecode.com/files/python-line_profiler-1.0-0.1.b2.fc10.src.rpm == == Create file "test.py" with the following content == import random, time def sleep(): seconds = random.randint(0, 5) print 'Sleeping %s seconds' % seconds time.sleep(seconds) @profile def test(): sleep() sleep() sleep() test() == == Run and profile == [silas@silas ~]$ kernprof.py -l test.py Sleeping 4 seconds Sleeping 5 seconds Sleeping 2 seconds Wrote profile results to test.py.lprof == == View results == [silas@silas ~]$ python -m line_profiler test.py.lprof Timer unit: 1e-06 s File: test.py Function: test at line 8 Total time: 10.9994 s Line # Hits Time Per Hit % Time Line Contents ============================================================== 8 @profile 9 def test(): 10 1 3999416 3999416.0 36.4 sleep() 11 1 4999982 4999982.0 45.5 sleep() 12 1 1999990 1999990.0 18.2 sleep()