Skip to content

Conversation

mdqst
Copy link

@mdqst mdqst commented Sep 18, 2025

I've gone through the system stats handling on Linux, Windows, and MacOS and made a few key fixes:

  • Linux /proc/stat: Added a check for len(data) < 11 to prevent IndexError on non-standard systems.
  • Division by zero: Added if total != 0 else 0.0 wherever idle percentages were calculated.
  • Windows: Corrected formula to user + kernel - idle and fixed GetSystemTimes error handling to properly raise WinError().
  • MacOS / UTC time: Removed .replace(tzinfo=None) to preserve correct ISO-formatted UTC timestamps.

these changes prevent crashes and ensure that system stats are calculated accurately across platforms.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

r? @jdno

rustbot has assigned @jdno.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Sep 18, 2025
@rust-log-analyzer

This comment has been minimized.

@mdqst mdqst requested a review from samueltardieu September 18, 2025 12:38
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
1 file would be reformatted, 26 files already formatted
--- /checkout/src/ci/cpu-usage-over-time.py
+++ /checkout/src/ci/cpu-usage-over-time.py
@@ -117,7 +117,11 @@
             idle = self.idle - prev.idle
             user = self.user - prev.user
             kernel = self.kernel - prev.kernel
-            return float(idle) / float(user + kernel - idle) * 100 if user + kernel - idle != 0 else 0.0
+            return (
+                float(idle) / float(user + kernel - idle) * 100
+                if user + kernel - idle != 0
+                else 0.0
+            )
 
 elif sys.platform == "darwin":
     from ctypes import *

rerun tidy with `--extra-checks=py:fmt --bless` to reformat Python code
tidy error: checks with external tool 'ruff' failed
some tidy checks failed
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/npm --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1561:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1281:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:14
  local time: Thu Sep 18 12:43:14 UTC 2025
  network time: Thu, 18 Sep 2025 12:43:14 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants