Batch 4: history/popup timing accuracy#109
Merged
Merged
Conversation
- #85 Process popup CPU chart: append one sample per *new* snapshot (gated on current_data_->timestamp) and consume the already-computed per-process percentages (cpu_user_percent/cpu_kernel_percent/memory_percent), instead of re-deriving counter deltas on a fixed 500ms wall-clock poll. The old scheme sampled the same snapshot twice (a 0% reading) and divided one tick's delta by half the elapsed time (a ~2x spike). Drops the now-unused prev_utime/ prev_stime/last_update fields. - #86a History "last 1/5 min" windows are now real wall-clock windows via a new HistoryStore::count_since(): the tick count came from the *current* refresh interval, so changing the interval mid-session made the window wrong for older samples. count_since returns how many recent samples fall in the window; the view feeds that to the existing count-based queries. - #86b get_series(): O(1) unordered_set membership instead of a linear std::find over the pid list per process per sample. - #86c export_csv(): snapshot samples_/process_names_ under the lock, then write the files without holding it, so a slow export doesn't block the collector's next record(). Built GUI+TUI+tests on Linux; 62 checks pass (incl. new count_since checks). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xodto1bRjCSGEzLuz3JFbV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 4 of the feedback fixes — the "recorded-over-time data doesn't line up with real elapsed time" cluster.
Closes #85
Closes #86
#85 — popup CPU chart alternated spikes and zeros
The popup sampled on a fixed 500 ms wall clock, but
current_data_only changes once per refresh interval — so it sampled the same snapshot twice (a 0% reading) or split one tick's counter delta over half the elapsed time (a ~2x spike). Now it appends one sample per new snapshot (gated oncurrent_data_->timestamp) and consumes the already-correct per-process percentages (cpu_user_percent/cpu_kernel_percent/memory_percent, computed once per tick by DataStore with the right elapsed time) instead of re-deriving deltas. Drops the now-unusedprev_utime/prev_stime/last_updatefields.#86 — history windows + hotspots
HistoryStore::count_since()— the tick count was derived from the current refresh interval, so changing the interval mid-session made the window wrong for older samples.get_series(): O(1)unordered_setmembership instead of a linearstd::findper process per sample.export_csv(): snapshotsamples_/process_names_under the lock, then write the files without holding it, so a slow export doesn't block the collector.Testing
Built GUI+TUI+tests on Linux; unit tests pass (62 checks, incl. new
count_sincechecks). Popup/history chart behavior to be confirmed in runtime testing.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xodto1bRjCSGEzLuz3JFbV