No Brainer way to profile your scripts

Hey, I hadnt done much profiling in python - only timing the script. but profiling is really easy…

my_main_profile and my_main are invented names


# Profile
# Had to do this to get it to work in ubuntu "sudo aptitude install python-profiler"

filename = '/tmp/pyprofile'

import hotshot
import profile
from hotshot import stats
def my_main_profile():
    prof = hotshot.Profile(filename)
    prof.runcall(my_main)
    prof.close()
    s = stats.load(filename)
    s.sort_stats("time").print_stats()

my_main_profile()