Skip to content

feat(disk): add disk read/write latency measurement and display#32

Merged
anistark merged 3 commits into
anistark:mainfrom
Rahul2512Chauhan:feature/disk-latency
Nov 26, 2025
Merged

feat(disk): add disk read/write latency measurement and display#32
anistark merged 3 commits into
anistark:mainfrom
Rahul2512Chauhan:feature/disk-latency

Conversation

@Rahul2512Chauhan
Copy link
Copy Markdown
Contributor

Screenshot 2025-11-26 at 01 52 51 Screenshot 2025-11-26 at 01 53 59

Summary

This PR adds support for measuring and displaying disk read and write
latency in the Disk widget.

What’s Added

  • Calculates read latency using (read_time / read operations)
  • Calculates write latency using (write_time / write operations)
  • Latency updates in real time alongside existing read/write throughput
  • Displays latency (in ms) inside the read/write panels

Why This Is Needed

Latency is an important metric for understanding disk performance.
Even when throughput looks normal, high latency can indicate slow I/O,
filesystem issues, or aging hardware.
This implements the requested functionality from Issue #6.

Testing

  • Verified on macOS that latency values update correctly.
  • Tested alongside read/write graph updates.
  • No UI regressions found in the Disk widget.

Related Issue

Closes #6

Introduce disk I/O latency tracking using psutil's read_time and write_time counters. The widget now shows per-operation latency for both reads and writes, alongside existing throughput, max, and total metrics.

This improves observability of slow disk operations and addresses feature request anistark#6.
@Rahul2512Chauhan
Copy link
Copy Markdown
Contributor Author

All linters, formatters, and type checks pass (just format, just lint, just type).
Ready for review. 👍

@anistark
Copy link
Copy Markdown
Owner

Thanks for the PR @Rahul2512Chauhan 🙌🏼

The "Free, Used, Total" line is repeating. Can you also fix that so it only appears once? It's a diff issue(#8) from your PR. But would be great to have it fixed.

@Rahul2512Chauhan
Copy link
Copy Markdown
Contributor Author

Rahul2512Chauhan commented Nov 26, 2025

Screenshot 2025-11-26 at 21 33 13

Hi @anistark 👋

I checked the duplication issue for the Free / Used / Total rows , it happens only on macOS (APFS) because multiple volumes point to the same physical disk and report identical stats.

So I applied filtering only for Darwin, showing just the / mount, while keeping full behaviour on Linux/Windows where partitions are real and distinct.

{
if platform.system() == "Darwin":
mountpoints = ["/"]
}

Before I push the fix , can you please confirm if this OS-specific approach sounds good to you?

Thanks! 🙌
(ig it kinda work idk 🤔)

@anistark
Copy link
Copy Markdown
Owner

Before I push the fix , can you please confirm if this OS-specific approach sounds good to you?

Sounds good. Thanks 🙌🏼

@Rahul2512Chauhan
Copy link
Copy Markdown
Contributor Author

Thanks @anistark for your guidance 🙌
All checks are passing ready for another review 👍

Copy link
Copy Markdown
Owner

@anistark anistark left a comment

Choose a reason for hiding this comment

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

@anistark anistark merged commit 45403bd into anistark:main Nov 26, 2025
@Rahul2512Chauhan Rahul2512Chauhan deleted the feature/disk-latency branch November 26, 2025 19:50
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.

[Feature] Disk Latency

2 participants