Skip to content

Commit

Permalink
write car params before profiling
Browse files Browse the repository at this point in the history
old-commit-hash: 176c064
  • Loading branch information
adeebshihadeh committed Oct 6, 2020
1 parent 2f754f6 commit daad4ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions selfdrive/test/profiling/profiler.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import os
import sys
import cProfile # pylint: disable=import-error
import pprofile # pylint: disable=import-error
import pyprof2calltree # pylint: disable=import-error

from common.params import Params
from tools.lib.logreader import LogReader
from selfdrive.test.profiling.lib import SubMaster, PubMaster, SubSocket, ReplayDone
from selfdrive.test.process_replay.process_replay import CONFIGS
Expand All @@ -25,6 +25,12 @@ def get_inputs(msgs, process):
trigger = sub_socks[0]
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)
pm = PubMaster()
if 'can' in sub_socks:
Expand All @@ -38,7 +44,7 @@ def profile(proc, func, car='toyota'):
segment, fingerprint = CARS[car]
segment = segment.replace('|', '/')
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

Expand Down

0 comments on commit daad4ce

Please sign in to comment.