Commits

Matthew Turk  committed 21e1e70

Switching back to cProfile from Hotshot

  • Participants
  • Parent commits 1ba6fe4

Comments (0)

Files changed (1)

File profile_support.py

 import time
 import cProfile
-import hotshot
+import cProfile
 
 import numpy as na
 import yt.utilities.command_line as cl
     for fname in sorted(functions_to_profile):
         print "HANDLING %s on %s / %s" % (
             fname, rank, size)
-        ofn = "profiles/%s_%s_%03i_%03i.hotshot" % (
+        ofn = "profiles/%s_%s_%03i_%03i.cprof" % (
             fname, _my_version, size, rank)
         times = []
         profile_runner.func = functions_to_profile[fname]
                 func(pf)
             MPI.COMM_WORLD.Barrier()
             t1 = time.time()
-            hprof = hotshot.Profile(ofn)
+            hprof = cProfile.Profile()
             hprof.runcall(profile_runner.run, pf)
-            hprof.close()
+            hprof.dump_stats(ofn)
             MPI.COMM_WORLD.Barrier()
             t2 = time.time()
             times.append(t2-t1)
         if output_html:
             print "Writing output file on %03i / %03i" % (rank, size)
             # We step through it
-            dname = "html/%s-%s/%s" % (td,_my_version, fname)
+            dname = "html/%s-%03i_%03i-%s/%s" % (td, size, rank, _my_version, fname)
             if rank == 0 and not os.path.exists(dname):
                 os.makedirs(dname)
             MPI.COMM_WORLD.Barrier()