mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-10-01 03:43:42 +08:00
openpilot v0.7.4 release
This commit is contained in:
@@ -14,9 +14,24 @@ def cputime_busy(ct):
|
||||
return ct.user + ct.nice + ct.system + ct.irq + ct.softirq
|
||||
|
||||
|
||||
def proc_cputime_total(ct):
|
||||
return ct.cpuUser + ct.cpuSystem + ct.cpuChildrenUser + ct.cpuChildrenSystem
|
||||
|
||||
|
||||
def proc_name(proc):
|
||||
name = proc.name
|
||||
if len(proc.cmdline):
|
||||
name = proc.cmdline[0]
|
||||
if len(proc.exe):
|
||||
name = proc.exe + " - " + name
|
||||
|
||||
return name
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--mem', action='store_true')
|
||||
parser.add_argument('--cpu', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
sm = SubMaster(['thermal', 'procLog'])
|
||||
@@ -26,6 +41,9 @@ if __name__ == "__main__":
|
||||
total_times = [0., 0., 0., 0.]
|
||||
busy_times = [0., 0., 0.0, 0.]
|
||||
|
||||
prev_proclog = None
|
||||
prev_proclog_t = None
|
||||
|
||||
while True:
|
||||
sm.update()
|
||||
|
||||
@@ -37,7 +55,6 @@ if __name__ == "__main__":
|
||||
if sm.updated['procLog']:
|
||||
m = sm['procLog']
|
||||
|
||||
|
||||
cores = [0., 0., 0., 0.]
|
||||
total_times_new = [0., 0., 0., 0.]
|
||||
busy_times_new = [0., 0., 0.0, 0.]
|
||||
@@ -57,16 +74,33 @@ if __name__ == "__main__":
|
||||
|
||||
print("CPU %.2f%% - RAM: %.2f - Temp %.2f" % (100. * np.mean(cores), last_mem, last_temp))
|
||||
|
||||
if args.cpu and prev_proclog is not None:
|
||||
procs = {}
|
||||
dt = (sm.logMonoTime['procLog'] - prev_proclog_t) / 1e9
|
||||
for proc in m.procs:
|
||||
try:
|
||||
name = proc_name(proc)
|
||||
prev_proc = [p for p in prev_proclog.procs if proc.pid == p.pid][0]
|
||||
cpu_time = proc_cputime_total(proc) - proc_cputime_total(prev_proc)
|
||||
cpu_usage = cpu_time / dt * 100.
|
||||
procs[name] = cpu_usage
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
print("Top CPU usage:")
|
||||
for k, v in sorted(procs.items(), key=lambda item: item[1], reverse=True)[:10]:
|
||||
print(f"{k.rjust(70)} {v:.2f} %")
|
||||
print()
|
||||
|
||||
if args.mem:
|
||||
mems = {}
|
||||
for proc in m.procs:
|
||||
name = proc.name
|
||||
if len(proc.cmdline):
|
||||
name = proc.cmdline[0]
|
||||
if len(proc.exe):
|
||||
name = proc.exe + " - " + name
|
||||
name = proc_name(proc)
|
||||
mems[name] = float(proc.memRss) / 1e6
|
||||
print("Top memory usage:")
|
||||
for k, v in sorted(mems.items(), key=lambda item: item[1], reverse=True)[:10]:
|
||||
print(f"{k.rjust(70)} {v:.2f} MB")
|
||||
print()
|
||||
|
||||
prev_proclog = m
|
||||
prev_proclog_t = sm.logMonoTime['procLog']
|
||||
|
||||
@@ -16,8 +16,7 @@ candidate_cars = all_known_cars()
|
||||
|
||||
|
||||
for addr, l in fingerprint.items():
|
||||
dat = messaging.new_message()
|
||||
dat.init('can', 1)
|
||||
dat = messaging.new_message('can', 1)
|
||||
|
||||
msg = dat.can[0]
|
||||
msg.address = addr
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import traceback
|
||||
import sys
|
||||
from tqdm import tqdm
|
||||
from tools.lib.logreader import LogReader
|
||||
from selfdrive.car.fw_versions import match_fw_to_car
|
||||
@@ -13,14 +13,15 @@ from selfdrive.car.honda.values import FINGERPRINTS as HONDA_FINGERPRINTS
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: ./test_fw_query_on_routes.py <route_list>/<route>")
|
||||
sys.exit(1)
|
||||
parser = argparse.ArgumentParser(description='Run FW fingerprint on Qlog of route or list of routes')
|
||||
parser.add_argument('route', help='Route or file with list of routes')
|
||||
parser.add_argument('--car', help='Force comparison fingerprint to known car')
|
||||
args = parser.parse_args()
|
||||
|
||||
if os.path.exists(sys.argv[1]):
|
||||
routes = list(open(sys.argv[1]))
|
||||
if os.path.exists(args.route):
|
||||
routes = list(open(args.route))
|
||||
else:
|
||||
routes = [sys.argv[1]]
|
||||
routes = [args.route]
|
||||
|
||||
wrong = 0
|
||||
good = 0
|
||||
@@ -51,6 +52,9 @@ if __name__ == "__main__":
|
||||
dongles.append(dongle_id)
|
||||
live_fingerprint = msg.carParams.carFingerprint
|
||||
|
||||
if args.car is not None:
|
||||
live_fingerprint = args.car
|
||||
|
||||
if live_fingerprint not in list(TOYOTA_FINGERPRINTS.keys()) + list(HONDA_FINGERPRINTS.keys()):
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user