From 28a5db2e6a4de8e5bc55bf98e3e91de3827eb632 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Fri, 9 Apr 2021 00:12:47 -0700 Subject: [PATCH] boardd: log slow hwmon reading --- selfdrive/boardd/boardd.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/boardd/boardd.cc b/selfdrive/boardd/boardd.cc index abf87208f5..831f5fa5cf 100644 --- a/selfdrive/boardd/boardd.cc +++ b/selfdrive/boardd/boardd.cc @@ -362,8 +362,13 @@ void panda_state_thread(bool spoofing_started) { ps.setUptime(pandaState.uptime); #ifdef QCOM2 + double read_time = millis_since_boot(); ps.setVoltage(std::stoi(util::read_file("/sys/class/hwmon/hwmon1/in1_input"))); ps.setCurrent(std::stoi(util::read_file("/sys/class/hwmon/hwmon1/curr1_input"))); + read_time = millis_since_boot() - read_time; + if (read_time > 50) { + LOGW("reading hwmon took %lfms", read_time); + } #else ps.setVoltage(pandaState.voltage); ps.setCurrent(pandaState.current);