write car params before profiling

pull/2281/head
Adeeb Shihadeh 5 years ago
parent 6709106025
commit 176c06499d
  1. 10
      selfdrive/test/profiling/profiler.py

@ -1,11 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sys import sys
import cProfile # pylint: disable=import-error import cProfile # pylint: disable=import-error
import pprofile # pylint: disable=import-error import pprofile # pylint: disable=import-error
import pyprof2calltree # pylint: disable=import-error import pyprof2calltree # pylint: disable=import-error
from common.params import Params
from tools.lib.logreader import LogReader from tools.lib.logreader import LogReader
from selfdrive.test.profiling.lib import SubMaster, PubMaster, SubSocket, ReplayDone from selfdrive.test.profiling.lib import SubMaster, PubMaster, SubSocket, ReplayDone
from selfdrive.test.process_replay.process_replay import CONFIGS from selfdrive.test.process_replay.process_replay import CONFIGS
@ -25,6 +25,12 @@ def get_inputs(msgs, process):
trigger = sub_socks[0] trigger = sub_socks[0]
break break
# some procs block on CarParams
for msg in msgs:
if msg.which() == 'carParams':
Params().put("CarParams", msg.as_builder().to_bytes())
break
sm = SubMaster(msgs, trigger, sub_socks) sm = SubMaster(msgs, trigger, sub_socks)
pm = PubMaster() pm = PubMaster()
if 'can' in sub_socks: if 'can' in sub_socks:
@ -38,7 +44,7 @@ def profile(proc, func, car='toyota'):
segment, fingerprint = CARS[car] segment, fingerprint = CARS[car]
segment = segment.replace('|', '/') segment = segment.replace('|', '/')
rlog_url = f"{BASE_URL}{segment}/rlog.bz2" rlog_url = f"{BASE_URL}{segment}/rlog.bz2"
msgs = list(LogReader(rlog_url)) msgs = list(LogReader(rlog_url)) * int(os.getenv("LOOP", "1"))
os.environ['FINGERPRINT'] = fingerprint os.environ['FINGERPRINT'] = fingerprint

Loading…
Cancel
Save