mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Print out profiling info when executing builtins.py
This commit is contained in:
parent
95cef2ceec
commit
927c5ccc54
@ -1727,6 +1727,28 @@ plugins += [
|
||||
if __name__ == '__main__':
|
||||
# Test load speed
|
||||
import subprocess, textwrap
|
||||
try:
|
||||
subprocess.check_call(['python', '-c', textwrap.dedent(
|
||||
'''
|
||||
import init_calibre # noqa
|
||||
|
||||
def doit():
|
||||
import calibre.customize.builtins as b # noqa
|
||||
|
||||
def show_stats():
|
||||
from pstats import Stats
|
||||
s = Stats('/tmp/calibre_stats')
|
||||
s.sort_stats('cumulative')
|
||||
s.print_stats(30)
|
||||
|
||||
import cProfile
|
||||
cProfile.run('doit()', '/tmp/calibre_stats')
|
||||
show_stats()
|
||||
|
||||
'''
|
||||
)])
|
||||
except subprocess.CalledProcessError:
|
||||
raise SystemExit(1)
|
||||
try:
|
||||
subprocess.check_call(['python', '-c', textwrap.dedent(
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user