run both deterministic and statistical profiler
parent
04bc4a0e45
commit
b3e7d94303
1
Pipfile
1
Pipfile
|
@ -70,6 +70,7 @@ aiohttp = "*"
|
|||
lru-dict = "*"
|
||||
scikit-image = "*"
|
||||
pygame = "==2.0.0.dev6"
|
||||
pprofile = "*"
|
||||
pyprof2calltree = "*"
|
||||
|
||||
[packages]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "d0ad31cf2a829d14b99ac88767488f0c5245a73297466c799102422eaa12eaa2"
|
||||
"sha256": "bffeedc179051a29c8e5153cf2e72503c8ead081816c47aec7cece0c73cbcb31"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -1968,6 +1968,13 @@
|
|||
],
|
||||
"version": "==1.7.0"
|
||||
},
|
||||
"pprofile": {
|
||||
"hashes": [
|
||||
"sha256:2036522d201188641ab6766b3fea105ddeb72d3b752a7d6da695be7e7ba21656"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==2.0.4"
|
||||
},
|
||||
"prometheus-client": {
|
||||
"hashes": [
|
||||
"sha256:71cd24a2b3eb335cb800c7159f423df1bd4dcd5171b234be15e3f31ec9f622da"
|
||||
|
|
|
@ -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')
|
||||
|
||||
# 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')
|
||||
|
||||
with cProfile.Profile() as pr:
|
||||
try:
|
||||
controlsd_thread(sm, pm, can_sock)
|
||||
except ReplayDone:
|
||||
pass
|
||||
|
||||
pyprof2calltree.convert(pr.getstats(), 'cachegrind.out.controlsd')
|
||||
pyprof2calltree.convert(pr.getstats(), 'cachegrind.out.controlsd_deterministic')
|
||||
|
|
Loading…
Reference in New Issue