mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-01 01:43:41 +08:00
Merge branch 'master' into sync-priv-20240227
# Conflicts: # panda # selfdrive/car/chrysler/values.py # selfdrive/car/ford/carstate.py # selfdrive/car/ford/interface.py # selfdrive/car/ford/values.py # selfdrive/car/interfaces.py # selfdrive/car/nissan/values.py # selfdrive/car/subaru/interface.py # selfdrive/car/volkswagen/interface.py # selfdrive/car/volkswagen/values.py # selfdrive/controls/radard.py # selfdrive/manager/process.py # selfdrive/modeld/modeld.py
This commit is contained in:
@@ -3,7 +3,6 @@ import argparse
|
||||
import binascii
|
||||
import time
|
||||
from collections import defaultdict
|
||||
from typing import Optional
|
||||
|
||||
import cereal.messaging as messaging
|
||||
from openpilot.selfdrive.debug.can_table import can_table
|
||||
@@ -96,8 +95,8 @@ if __name__ == "__main__":
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
init_lr: Optional[LogIterable] = None
|
||||
new_lr: Optional[LogIterable] = None
|
||||
init_lr: LogIterable | None = None
|
||||
new_lr: LogIterable | None = None
|
||||
|
||||
if args.init:
|
||||
if args.init == '':
|
||||
|
||||
@@ -3,7 +3,7 @@ import argparse
|
||||
import numpy as np
|
||||
import time
|
||||
from collections import defaultdict, deque
|
||||
from typing import DefaultDict, Deque, MutableSequence
|
||||
from collections.abc import MutableSequence
|
||||
|
||||
import cereal.messaging as messaging
|
||||
|
||||
@@ -19,8 +19,8 @@ if __name__ == "__main__":
|
||||
socket_names = args.socket
|
||||
sockets = {}
|
||||
|
||||
rcv_times: DefaultDict[str, MutableSequence[float]] = defaultdict(lambda: deque(maxlen=100))
|
||||
valids: DefaultDict[str, Deque[bool]] = defaultdict(lambda: deque(maxlen=100))
|
||||
rcv_times: defaultdict[str, MutableSequence[float]] = defaultdict(lambda: deque(maxlen=100))
|
||||
valids: defaultdict[str, deque[bool]] = defaultdict(lambda: deque(maxlen=100))
|
||||
|
||||
t = time.monotonic()
|
||||
for name in socket_names:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
from typing import Dict
|
||||
|
||||
import cereal.messaging as messaging
|
||||
from cereal.services import SERVICE_LIST
|
||||
@@ -10,7 +9,7 @@ TO_CHECK = ['carState']
|
||||
if __name__ == "__main__":
|
||||
sm = messaging.SubMaster(TO_CHECK)
|
||||
|
||||
prev_t: Dict[str, float] = {}
|
||||
prev_t: dict[str, float] = {}
|
||||
|
||||
while True:
|
||||
sm.update()
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
import sys
|
||||
import time
|
||||
import numpy as np
|
||||
from typing import DefaultDict, MutableSequence
|
||||
from collections.abc import MutableSequence
|
||||
from collections import defaultdict, deque
|
||||
|
||||
import cereal.messaging as messaging
|
||||
|
||||
socks = {s: messaging.sub_sock(s, conflate=False) for s in sys.argv[1:]}
|
||||
ts: DefaultDict[str, MutableSequence[float]] = defaultdict(lambda: deque(maxlen=100))
|
||||
ts: defaultdict[str, MutableSequence[float]] = defaultdict(lambda: deque(maxlen=100))
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
|
||||
@@ -4,7 +4,7 @@ import math
|
||||
import datetime
|
||||
from collections import Counter
|
||||
from pprint import pprint
|
||||
from typing import List, Tuple, cast
|
||||
from typing import cast
|
||||
|
||||
from cereal.services import SERVICE_LIST
|
||||
from openpilot.tools.lib.logreader import LogReader, ReadMode
|
||||
@@ -15,8 +15,8 @@ if __name__ == "__main__":
|
||||
cams = [s for s in SERVICE_LIST if s.endswith('CameraState')]
|
||||
cnt_cameras = dict.fromkeys(cams, 0)
|
||||
|
||||
events: List[Tuple[float, set[str]]] = []
|
||||
alerts: List[Tuple[float, str]] = []
|
||||
events: list[tuple[float, set[str]]] = []
|
||||
alerts: list[tuple[float, str]] = []
|
||||
start_time = math.inf
|
||||
end_time = -math.inf
|
||||
ignition_off = None
|
||||
|
||||
@@ -66,12 +66,12 @@ if __name__ == "__main__":
|
||||
for p in psutil.process_iter():
|
||||
if p == psutil.Process():
|
||||
continue
|
||||
matched = any(l for l in p.cmdline() if any(pn for pn in monitored_proc_names if re.match(r'.*{}.*'.format(pn), l, re.M | re.I)))
|
||||
matched = any(l for l in p.cmdline() if any(pn for pn in monitored_proc_names if re.match(fr'.*{pn}.*', l, re.M | re.I)))
|
||||
if matched:
|
||||
k = ' '.join(p.cmdline())
|
||||
print('Add monitored proc:', k)
|
||||
stats[k] = {'cpu_samples': defaultdict(list), 'min': defaultdict(lambda: None), 'max': defaultdict(lambda: None),
|
||||
'avg': defaultdict(lambda: 0.0), 'last_cpu_times': None, 'last_sys_time': None}
|
||||
'avg': defaultdict(float), 'last_cpu_times': None, 'last_sys_time': None}
|
||||
stats[k]['last_sys_time'] = timer()
|
||||
stats[k]['last_cpu_times'] = p.cpu_times()
|
||||
monitored_procs.append(p)
|
||||
|
||||
@@ -67,7 +67,7 @@ def format_brand_fw_versions(brand, extra_fw_versions: None | dict[str, dict[tup
|
||||
extra_fw_versions = extra_fw_versions or {}
|
||||
|
||||
fingerprints_file = os.path.join(BASEDIR, f"selfdrive/car/{brand}/fingerprints.py")
|
||||
with open(fingerprints_file, "r") as f:
|
||||
with open(fingerprints_file) as f:
|
||||
comments = [line for line in f.readlines() if line.startswith("#") and "noqa" not in line]
|
||||
|
||||
with open(fingerprints_file, "w") as f:
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import cereal.messaging as messaging
|
||||
from typing import Optional
|
||||
|
||||
if __name__ == "__main__":
|
||||
modeld_sock = messaging.sub_sock("modelV2")
|
||||
|
||||
last_frame_id = None
|
||||
start_t: Optional[int] = None
|
||||
start_t: int | None = None
|
||||
frame_cnt = 0
|
||||
dropped = 0
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from collections import defaultdict
|
||||
|
||||
from cereal.messaging import SubMaster
|
||||
from openpilot.common.numpy_fast import mean
|
||||
from typing import Optional, Dict
|
||||
|
||||
def cputime_total(ct):
|
||||
return ct.user + ct.nice + ct.system + ct.idle + ct.iowait + ct.irq + ct.softirq
|
||||
@@ -42,8 +41,8 @@ if __name__ == "__main__":
|
||||
total_times = [0.]*8
|
||||
busy_times = [0.]*8
|
||||
|
||||
prev_proclog: Optional[capnp._DynamicStructReader] = None
|
||||
prev_proclog_t: Optional[int] = None
|
||||
prev_proclog: capnp._DynamicStructReader | None = None
|
||||
prev_proclog_t: int | None = None
|
||||
|
||||
while True:
|
||||
sm.update()
|
||||
@@ -76,7 +75,7 @@ if __name__ == "__main__":
|
||||
print(f"CPU {100.0 * mean(cores):.2f}% - RAM: {last_mem:.2f}% - Temp {last_temp:.2f}C")
|
||||
|
||||
if args.cpu and prev_proclog is not None and prev_proclog_t is not None:
|
||||
procs: Dict[str, float] = defaultdict(float)
|
||||
procs: dict[str, float] = defaultdict(float)
|
||||
dt = (sm.logMonoTime['procLog'] - prev_proclog_t) / 1e9
|
||||
for proc in m.procs:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user