Skip to content

reject a CPU sample with no elapsed time - #54

Merged
JamesLinYJ merged 1 commit into
mainfrom
cursor/cpu-zero-elapsed
Nov 9, 2026
Merged

JamesLinYJ merged 1 commit into
mainfrom
cursor/cpu-zero-elapsed

Conversation

@JamesLinYJ

Copy link
Copy Markdown
Owner

Summary

calculate_cpu_delta set valid before checking elapsed time, and a failed detail counter returned immediately. A zero or missing interval could therefore be published as a real CPU percent.

A missing or zero elapsed_ms now leaves valid false and reports CpuDiagnosticError::InvalidElapsedTime before processor percents are written. A nonzero interval with a healthy total still sets valid true, including a real 0% idle sample. Detail-counter failures are still reported when the interval is nonzero.

Test

Host unit run of the sampler delta tests (the Windows resource link is not available here):

  • zero elapsed, including a regressed detail counter, does not set valid
  • a later nonzero interval with real 0% usage stays valid
  • existing baseline, aggregation, and primary-counter regression cases still pass
Open in Web Open in Cursor 

A missing or zero interval set valid before the elapsed check, and a failed
detail counter returned before that check ran. Leave valid false, report
InvalidElapsedTime, and do not publish processor percents from that interval.

Co-authored-by: jameslincn <jameslincn@outlook.sg>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T07:00:59.100999Z 2c81dbf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@JamesLinYJ
JamesLinYJ merged commit 823162f into main Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants