mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Make it possible to have higher precision with pstats displayed
This commit is contained in:
@@ -18,11 +18,26 @@ Options:
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import profile
|
import profile
|
||||||
|
import pstats
|
||||||
|
|
||||||
from docopt import docopt
|
from docopt import docopt
|
||||||
import jedi
|
import jedi
|
||||||
|
|
||||||
|
|
||||||
|
# Monkeypatch the time formatting function of profiling to make it easier to
|
||||||
|
# understand small time differences.
|
||||||
|
def f8(x):
|
||||||
|
ret = "%7.3f " % x
|
||||||
|
if ret == ' 0.000 ':
|
||||||
|
return "%6dµs" % (x * 10000000)
|
||||||
|
if ret.startswith(' 0.00'):
|
||||||
|
return "%8.4f" % x
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
pstats.f8 = f8
|
||||||
|
|
||||||
|
|
||||||
def run(code, index, infer=False):
|
def run(code, index, infer=False):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
script = jedi.Script(code)
|
script = jedi.Script(code)
|
||||||
|
|||||||
Reference in New Issue
Block a user