From edcf2f82aa299fcc2f548263770bad02685ed100 Mon Sep 17 00:00:00 2001 From: cghague <53837824+cghague@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:58:18 +0100 Subject: [PATCH] Improve CPU throttle lines in TinyPilot logs (#1543) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #1489 Parses the output of `vcgencmd get_throttled` into a simple “yes” or “no” result. ## Decoding the output of `vcgencmd get_throttled` We could decode the output of `vcgencmd get_throttled` to get more details, but for our purposes we simply want to detect that nothing relating to throttling has occurred since the device was booted, a situation which is indicated by an output value of `0x0`. Review
on CodeApprove --- .../tinypilot-privileged/scripts/collect-debug-logs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs b/debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs index 9a8055a34..b67666201 100755 --- a/debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs +++ b/debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs @@ -136,7 +136,15 @@ print_info "Checking temperature..." } >> "${LOG_FILE}" print_info "Checking throttled state..." -printf "%s\n\n" "$(vcgencmd get_throttled)" >> "${LOG_FILE}" +{ + CPU_THROTTLED="yes" + if vcgencmd get_throttled | grep --line-regexp --quiet "throttled=0x0" ; then + CPU_THROTTLED="no" + fi + readonly CPU_THROTTLED + echo "CPU throttled since boot: ${CPU_THROTTLED}" + printf "\n" +} >> "${LOG_FILE}" print_info "Checking for voltage issues..." {