Skip to content

Commit

Permalink
Improve CPU throttle lines in TinyPilot logs (#1543)
Browse files Browse the repository at this point in the history
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`.
<a data-ca-tag
href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1543"><img
src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review
on CodeApprove" /></a>
  • Loading branch information
cghague authored Aug 9, 2023
1 parent 48f63f8 commit edcf2f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
{
Expand Down

0 comments on commit edcf2f8

Please sign in to comment.