def profile(): import profile profile.run("from sizer import scanner; objs=scanner.Objects()", "prof") import pstats pstats.Stats("prof").strip_dirs().sort_stats("time").print_stats() if __name__ == "__main__": profile()