def profileMain(args, config): # pragma: no cover
'''This is the main function for profiling
http://code.google.com/appengine/kb/commontasks.html#profiling
'''
import cProfile
import pstats
eyed3.log.debug("driver profileMain")
prof = cProfile.Profile()
prof = prof.runctx("main(args)", globals(), locals())
stream = StringIO()
stats = pstats.Stats(prof, stream=stream)
stats.sort_stats("time") # Or cumulative
stats.print_stats(100) # 80 = how many to print
# The rest is optional.
stats.print_callees()
stats.print_callers()
sys.stderr.write("Profile data:\n%s\n" % stream.getvalue())
return 0
评论列表
文章目录