Skip to content

Add per-process disk I/O read and write speed to process management#1179

Merged
GT-610 merged 4 commits into
mainfrom
proc-io-speed
May 25, 2026
Merged

Add per-process disk I/O read and write speed to process management#1179
GT-610 merged 4 commits into
mainfrom
proc-io-speed

Conversation

@GT-610
Copy link
Copy Markdown
Collaborator

@GT-610 GT-610 commented May 25, 2026

#1175 #1178

Summary

  • Add per-process disk I/O tracking to the process management view, including read and write speed calculation across refresh snapshots.
  • Extend process collection and parsing for Linux and Windows so IO counters are surfaced alongside existing CPU and memory data.
  • Update the process list UI to display IO throughput when available and support sorting by read or write speed.
  • Add unit coverage for parsing, delta calculation, sorting, and Windows JSON-shaped process output.

Testing

  • dart analyze passed for the touched Dart model, UI, and script builder files.
  • dart test test/proc_test.dart passed with coverage for legacy process parsing plus the new IO speed scenarios.
  • Manual validation confirmed the new IO columns remain hidden when data is unavailable and do not disturb existing process actions.

Summary by CodeRabbit

  • New Features

    • Process monitoring now displays disk I/O metrics including read and write transfer speeds for each process.
    • I/O data collection enabled across Windows and Unix-like systems.
    • Added sort options to organize processes by read and write transfer speeds.
  • Tests

    • Expanded test coverage for process I/O metric parsing and speed calculations across different platforms.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2af2cf50-84db-4e20-8ee2-1c4c6f0b8dd3

📥 Commits

Reviewing files that changed from the base of the PR and between b7f0b22 and 4d6dba6.

📒 Files selected for processing (2)
  • lib/data/model/app/scripts/script_builders.dart
  • lib/view/page/process.dart

📝 Walkthrough

Walkthrough

This PR extends process monitoring to collect per-process disk I/O read/write counters and compute transfer speeds from sample deltas. Windows and Unix collection scripts were updated to emit I/O counters. The Proc model now includes nullable readBytes, writeBytes, readSpeed, and writeSpeed; PsResult carries sampledAtMillis and can accept a previous sample for elapsed-time-based speed computation. The process UI passes previous results to parsing, prunes read/write sort modes if I/O data is absent, and displays formatted speed metrics. Tests were added/expanded for parsing, speed calculation, rollback handling, and sorting.

Possibly related PRs

Suggested reviewers

  • lollipopkit
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding per-process disk I/O read and write speed metrics to the process management system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch proc-io-speed

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested a review from lollipopkit May 25, 2026 03:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/view/page/process.dart (1)

183-234: ⚡ Quick win

Split these UI helpers into extension on _ProcessPageState sections (Widget/Actions/Utils).

The new trail rendering and formatter are still embedded in the state class. Please align with the view-layer structure rule for extension-based splitting.

As per coding guidelines: "Split UI into Widget build, Actions, Utils using extension on to achieve this pattern".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/view/page/process.dart` around lines 183 - 234, The _buildItemTrail
widget and _formatSpeed utility are still inside the state class; extract them
into extension blocks to follow the Widget/Actions/Utils split: move the
_buildItemTrail(Proc proc) implementation into an extension on _ProcessPageState
dedicated to Widgets (e.g., extension on _ProcessPageState { Widget
_buildItemTrail(Proc proc) { ... } }), place any action-related helpers (if
present in this region) into an Actions extension, and move _formatSpeed(double)
into a Utils extension (e.g., extension on _ProcessPageState { String
_formatSpeed(double bytes) => ... }), keeping all references to _client,
_refresh, context.showRoundDialog, etc., unchanged so callers in
_ProcessPageState continue to work.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/data/model/app/scripts/script_builders.dart`:
- Around line 260-265: The shell snippet uses an unquoted set -- $line which
allows pathname expansion (globbing) on ps args; to fix, wrap the set call with
temporary globbing disabled: call set -f before set -- $line and restore with
set +f after (i.e., insert set -f; set -- $line; set +f) so fields split as
before but wildcard expansion cannot alter the COMMAND; update the code around
the existing ps ... | while IFS= read -r line; do block and keep other variables
(pid, user, cpu, ... cmd) unchanged.

---

Nitpick comments:
In `@lib/view/page/process.dart`:
- Around line 183-234: The _buildItemTrail widget and _formatSpeed utility are
still inside the state class; extract them into extension blocks to follow the
Widget/Actions/Utils split: move the _buildItemTrail(Proc proc) implementation
into an extension on _ProcessPageState dedicated to Widgets (e.g., extension on
_ProcessPageState { Widget _buildItemTrail(Proc proc) { ... } }), place any
action-related helpers (if present in this region) into an Actions extension,
and move _formatSpeed(double) into a Utils extension (e.g., extension on
_ProcessPageState { String _formatSpeed(double bytes) => ... }), keeping all
references to _client, _refresh, context.showRoundDialog, etc., unchanged so
callers in _ProcessPageState continue to work.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2a85597c-5e94-4e48-8c61-251d253756b0

📥 Commits

Reviewing files that changed from the base of the PR and between e52ef43 and b7f0b22.

📒 Files selected for processing (6)
  • lib/data/model/app/scripts/script_builders.dart
  • lib/data/model/server/proc.dart
  • lib/data/res/github_id.dart
  • lib/view/page/process.dart
  • packages/dartssh2
  • test/proc_test.dart

Comment thread lib/data/model/app/scripts/script_builders.dart
@GT-610 GT-610 merged commit 3bce429 into main May 25, 2026
3 checks passed
@GT-610 GT-610 deleted the proc-io-speed branch May 25, 2026 04:02
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.

1 participant