run both deterministic and statistical profiler

old-commit-hash: b3e7d94303
commatwo_master
Willem Melching 5 years ago
parent 06012f4867
commit 46ab48372b
  1. 4
      Pipfile
  2. 4
      Pipfile.lock
  3. 1
      selfdrive/test/profiling/.gitignore
  4. 19
      selfdrive/test/profiling/controlsd.py

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94e2c66a6fa302e7647173231d4216d592804d511959ebce167ee9fa1aecfeb0
size 2037
oid sha256:828a9452e8ceddbc4f4eb34173f1f5950965f39362bd3e0abe889b8840511718
size 2052

4
Pipfile.lock generated

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b54f699108a7a9df59fd5b98f505426c8b81860dbe3a6b1a50d55729deb24079
size 164420
oid sha256:de11e37ffe851437b67ec038f9a938a6e562bc6cafd762b048f1f3ad81b452af
size 164644

@ -1 +1,2 @@
cachegrind.out.*
*.prof

@ -1,14 +1,13 @@
#!/usr/bin/env python3
import cProfile
import pprofile
import pyprof2calltree
from tools.lib.logreader import LogReader
from selfdrive.controls.controlsd import controlsd_thread
from selfdrive.test.profiling.lib import SubMaster, PubMaster, SubSocket, ReplayDone
BASE_URL = "https://commadataci.blob.core.windows.net/openpilotci/"
SEGMENT = "99c94dc769b5d96e|2019-08-03--14-19-59/2"
@ -22,10 +21,22 @@ if __name__ == "__main__":
sm = SubMaster(msgs, 'can', ['thermal', 'health', 'liveCalibration', 'dMonitoringState', 'plan', 'pathPlan', 'model'])
can_sock = SubSocket(msgs, 'can')
with cProfile.Profile() as pr:
# Statistical
with pprofile.StatisticalProfile()(period=0.00001) as pr:
try:
controlsd_thread(sm, pm, can_sock)
except ReplayDone:
pass
pr.dump_stats('cachegrind.out.controlsd_statistical')
# Deterministic
pm = PubMaster(['sendcan', 'controlsState', 'carState', 'carControl', 'carEvents', 'carParams'])
sm = SubMaster(msgs, 'can', ['thermal', 'health', 'liveCalibration', 'dMonitoringState', 'plan', 'pathPlan', 'model'])
can_sock = SubSocket(msgs, 'can')
pyprof2calltree.convert(pr.getstats(), 'cachegrind.out.controlsd')
with cProfile.Profile() as pr:
try:
controlsd_thread(sm, pm, can_sock)
except ReplayDone:
pass
pyprof2calltree.convert(pr.getstats(), 'cachegrind.out.controlsd_deterministic')

Loading…
Cancel
Save