Changeset - 5e905ff44e84
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 11 years ago 2014-06-15 03:09:48
drewp@bigasterisk.com
CC now suports statprof profiling, and every other profile() call is now broken
Ignore-this: bc7c31af6598e7c132d2f847afe8de68
2 files changed with 17 insertions and 8 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -490,7 +490,7 @@ def main():
 
                      help="live reload of themes and code")
 
    parser.add_option("--startup-only", action='store_true',
 
                      help="quit after loading everything (for timing tests)")
 
    parser.add_option("--profile", action='store_true', help='profile')
 
    parser.add_option("--profile", help='"hotshot" or "stat"')
 
    clientsession.add_option(parser)
 
    opts, args = parser.parse_args()
 

	
light9/prof.py
Show inline comments
 
import sys, traceback, time, logging
 
log = logging.getLogger()
 

	
 
def run(main, profile=False):
 
def run(main, profile=None):
 
    if not profile:
 
        main()
 
        return
 
    
 
    import hotshot, hotshot.stats
 
    p = hotshot.Profile("/tmp/pro")
 
    p.runcall(main)
 
    p.close()
 
    hotshot.stats.load("/tmp/pro").sort_stats('cumulative').print_stats()
 

	
 
    if profile == 'hotshot':
 
        import hotshot, hotshot.stats
 
        p = hotshot.Profile("/tmp/pro")
 
        p.runcall(main)
 
        p.close()
 
        hotshot.stats.load("/tmp/pro").sort_stats('cumulative').print_stats()
 
    elif profile == 'stat':
 
        import statprof
 
        statprof.start()
 
        try:
 
            main()
 
        finally:
 
            statprof.stop()
 
            statprof.display()
 
    
 
def watchPoint(filename, lineno, event="call"):
 
    """whenever we hit this line, print a stack trace. event='call'
0 comments (0 inline, 0 general)