Exemple #1
0
 def do_profiling(cls):
     results = []
     prof = cls(timer, 0.001)
     start_timer = timer()
     prof.runctx("testfunc()", {'testfunc':testfunc}, locals())
     results.append(timer() - start_timer)
     for methodname in methodnames:
         import pstats
         from StringIO import StringIO
         s = StringIO()
         stats = pstats.Stats(prof, stream=s)
         stats.strip_dirs().sort_stats("stdname")
         getattr(stats, methodname)()
         results.append(s.getvalue())
     return results, prof
Exemple #2
0
 def do_profiling(cls):
     results = []
     prof = cls(timer, 0.001)
     start_timer = timer()
     prof.runctx("testfunc()", {'testfunc': testfunc}, locals())
     results.append(timer() - start_timer)
     for methodname in methodnames:
         import pstats
         from StringIO import StringIO
         s = StringIO()
         stats = pstats.Stats(prof, stream=s)
         stats.strip_dirs().sort_stats("stdname")
         getattr(stats, methodname)()
         results.append(s.getvalue())
     return results, prof