python - How to create visual profiler? -


i visualize statistics program's running time in python. unfortunately program has written in fortran , c++, , cannot use language specific visualization tool. output of program have created class including start time , end time of different functions, , subroutines. example:

class myprogramruntime:     def __init__(self):         self.foo1calltime         self.foo1endtime         self.foo2calltime         self.foo2endtime 

i similar plot on picture on following link: picture

i not sure if best solution, works nice me. have used matplotlib.patches lib plot long rectangles actual function/subroutine runned in seconds. variables in class float variables, got them extracting actual datetime datetime of program's beginning datetime.timedelta.total_seconds() . plotting looks following:

    import matplotlib.pyplot plt     import matplotlib.patches patches      def plotrunningtimes(mpr): #mpr instance of myprogramruntime class         fig = plt.figure()         ax = plt.subplot(111)         ax.add_patch( patches.rectangle( (mpr.foo1calltime, 0.1),                                           mpr.foo1endtime-mpr.foo1calltime,                                           0.1) ) 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -