Changeset 1690

Show
Ignore:
Timestamp:
07/19/07 17:05:42 (1 year ago)
Author:
wrobe..@pld-linux.org
Message:

- use cProfile if possible

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/utils/command/run.py

    r1678 r1690  
    112112            if self.profile: 
    113113                print 'Enabling profiling...' 
    114                 import hotshot, hotshot.stats 
    115                 prof = hotshot.Profile('gaphor.prof') 
    116                 prof.runcall(starter) 
    117                 prof.close() 
    118                 stats = hotshot.stats.load('gaphor.prof') 
    119                 stats.strip_dirs() 
    120                 stats.sort_stats('time', 'calls') 
    121                 stats.print_stats(20) 
     114                try: 
     115                    import cProfile 
     116                    import pstats 
     117                    prof = cProfile.Profile() 
     118                    prof.runcall(starter) 
     119                    prof.dump_stats('gaphor.prof') 
     120                    p = pstats.Stats('gaphor.prof') 
     121                    p.strip_dirs().sort_stats('time').print_stats(20) 
     122                except ImportError, ex: 
     123                    import hotshot, hotshot.stats 
     124                    prof = hotshot.Profile('gaphor.prof') 
     125                    prof.runcall(starter) 
     126                    prof.close() 
     127                    stats = hotshot.stats.load('gaphor.prof') 
     128                    stats.strip_dirs() 
     129                    stats.sort_stats('time', 'calls') 
     130                    stats.print_stats(20) 
    122131            else: 
    123132                starter()