don't want to profile that

pull/2281/head
Adeeb Shihadeh 5 years ago
parent 0d11acf34e
commit 6709106025
  1. 9
      selfdrive/test/profiling/profiler.py

@ -42,8 +42,7 @@ def profile(proc, func, car='toyota'):
os.environ['FINGERPRINT'] = fingerprint os.environ['FINGERPRINT'] = fingerprint
def run(): def run(sm, pm, can_sock):
sm, pm, can_sock = get_inputs(msgs, proc)
try: try:
if can_sock is not None: if can_sock is not None:
func(sm, pm, can_sock) func(sm, pm, can_sock)
@ -53,13 +52,15 @@ def profile(proc, func, car='toyota'):
pass pass
# Statistical # Statistical
sm, pm, can_sock = get_inputs(msgs, proc)
with pprofile.StatisticalProfile()(period=0.00001) as pr: with pprofile.StatisticalProfile()(period=0.00001) as pr:
run() run(sm, pm, can_sock)
pr.dump_stats(f'cachegrind.out.{proc}_statistical') pr.dump_stats(f'cachegrind.out.{proc}_statistical')
# Deterministic # Deterministic
sm, pm, can_sock = get_inputs(msgs, proc)
with cProfile.Profile() as pr: with cProfile.Profile() as pr:
run() run(sm, pm, can_sock)
pyprof2calltree.convert(pr.getstats(), f'cachegrind.out.{proc}_deterministic') pyprof2calltree.convert(pr.getstats(), f'cachegrind.out.{proc}_deterministic')

Loading…
Cancel
Save