Commits

Sümer Cip  committed 83cd9d1

callgrind output changed to include (module_name + lineno in func stats like prof2calltree tool does.)

  • Participants
  • Parent commits 025db4d

Comments (0)

Files changed (4)

         pit->name = PyStr_FromString(PyStr_AS_CSTRING(cobj->co_name));
     }
 
-    PyFrame_LocalsToFast(fobj,0);
+    PyFrame_LocalsToFast(fobj, 0);
 
     return pit;
 }

File test/callgrind.py

 
 if __name__ == '__main__':
     yappi.start()
-    #main()
+    main()
     #foo()
     #f(5)
-    frecursive(5)
+    #frecursive(5)
     yappi.stop()
     
-    filename = 'callgrind.out'
+    filename = 'callgrind.yappi'
     yappi.get_func_stats().save(filename, type='callgrind')
     test_print('\nWritten callgrind file to %s\n' % filename)
+    yappi.get_func_stats().debug_print()
+    
+    if sys.hexversion < 0x03000000:
+        import cProfile
+        cProfile.run('main()', 'fooprof')
+        import pstats
+        p = pstats.Stats('fooprof')
+        #p.strip_dirs().sort_stats(-1).print_stats()
+        from pyprof2calltree import convert
+        convert('fooprof', 'callgrind.cprofile')

File test/stats.py

 #yfs.debug_print()
 for stat in yfs:
     fstatin1 = fstats1.find_by_full_name(stat.full_name)
-    if fstatin1:
+    fstatin2 = fstats2.find_by_full_name(stat.full_name)
+    
         
 
         func_ids = ['']
         for func_stat in self:
             file_ids += [ 'fl=(%d) %s' % (func_stat.index, func_stat.module) ]
-            func_ids += [ 'fn=(%d) %s' % (func_stat.index, func_stat.name) ]
+            func_ids += [ 'fn=(%d) %s %s:%s' % (func_stat.index, func_stat.name, func_stat.module, func_stat.lineno) ]
 
         lines += file_ids + func_ids