Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CPU throttle lines in TinyPilot logs #1543

Merged
merged 5 commits into from
Aug 9, 2023

Conversation

cghague
Copy link
Contributor

@cghague cghague commented Aug 2, 2023

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

@cghague cghague requested a review from mtlynch August 2, 2023 14:21
@mtlynch mtlynch requested review from jdeanwallace and removed request for mtlynch August 2, 2023 14:23
@codeapprove
Copy link

codeapprove bot commented Aug 2, 2023

Automated comment from CodeApprove ➜

👀 @cghague it's your turn, please take a look

Copy link
Contributor

mtlynch commented Aug 2, 2023

Automated comment from CodeApprove ➜

@jdeanwallace please review this Pull Request

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

⏳ Approval Pending (2 unresolved comments)
Approval will be granted automatically when all comments are resolved

LGTM, thanks!


In: Discussion
With regards to consistency, #1489 suggests:

CPU throttled since boot: No

However, I think the current style of the rest of the logs is for the value after the colon to be lowercase. For example:

TinyPilot state
Read-only filesystem: off
SSH access: enabled
Mouse jiggler: disabled

Can we use a lowercase "yes"/"no"?


In: debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs:

> Line 139
  if vcgencmd get_throttled | grep -q "0x0" ; then

I'm not sure what all the possible outputs of vcgencmd get_throttled can be, but just to be safe can we make sure that grep matches the entire line exactly?

Something like:

if vcgencmd get_throttled | grep --line-regexp -q '0x0' ; then

👀 @cghague it's your turn please take a look

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

⏳ Approval Pending (3 unresolved comments)
Approval will be granted automatically when all comments are resolved


In: debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs:

> Line 137
printf "%s\n\n" "$(vcgencmd get_throttled)" >> "${LOG_FILE}"

Also, can we preserve the extra newline?

Before:

Screen Shot 2023-08-02 at 17.47.36.png

After:

Screen Shot 2023-08-02 at 17.50.58.png


👀 @cghague it's your turn please take a look

Copy link
Contributor Author

@cghague cghague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

In: Discussion
Resolved


In: debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs:
Great point! Resolved.


In: debian-pkg/opt/tinypilot-privileged/scripts/collect-debug-logs:

> Line 137
printf "%s\n\n" "$(vcgencmd get_throttled)" >> "${LOG_FILE}"

Resolved

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

Approved: I have approved this change on CodeApprove and all of my comments have been resolved.

@jdeanwallace jdeanwallace dismissed their stale review August 9, 2023 23:54

Review approved on CodeApprove

@cghague cghague merged commit edcf2f8 into master Aug 9, 2023
12 checks passed
@cghague cghague deleted the 1489-improve-cpu-throttle-lines-in-tinypilot-logs branch August 9, 2023 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve CPU throttle lines in TinyPilot logs
3 participants