Repository navigation
darwin: add I/O screen tab with per-process disk I/O - #2133
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Change: Feature Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: ASSERTIVE
- Plan: Advanced
- Run ID:
d447a665-a82a-4ac2-a763-70ff2404b549
📒 Files selected for processing (5)
darwin/DarwinProcess.cdarwin/DarwinProcess.hdarwin/DarwinProcessTable.cdarwin/Platform.cdarwin/ProcessField.h
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
f3d72d4 to
5c52175
Compare
|
Addressed both findings in 5c52175:
Verified in a live macOS session: under disk load the rates show proper deltas (e.g. |
|
Please split the commit into one providing the new columns and another one to add this new screen. |
5c52175 to
1257b4a
Compare
|
Split into two commits as requested:
No code changes; the resulting tree is identical to the previous commit. |
1257b4a to
8aa9c05
Compare
|
Good catch — fixed in The rate delta now uses Note: |
Thx.
BTW, the wording+style in your first commit message can be cleaned up slightly like this: Regarding RCHAR/WCHAR: That's characters read/written in total IIRC. While SYSCR and SYSCW is number of read(2)/write(2) syscalls. The difference for RBYTES vs. RCHAR and WBYTES vs. WCHAR is likely mostly one coming from the data source these are derived from. Would have to investigate those. Edit: See below. CNCLWB (Cancelled Writtten Bytes) is the number of I/O requested, but cancelled later. That's likely specific to Linux and has little priority. IO_PRIORITY is platform-specific, but usually couples with the overall process priority and determines, given a saturated I/O link, which process is allowed first when determining which data should be written next. This would for MacOS likely map to the concept of IO policies managed by getiopolicy_np() and setiopolicy_np(). The PERCENT_*_DELAY are the I/O delay accounting metrics, which provide information about how much time a process was waiting on its synchronous I/O to be completed. AFAICT there's no clean mapping of this on MacOS. If you include these additional columns, it's fine (and slightly preferred) to have them as separate commits. For the Linux bugfix on monotonic vs. wallclock time, put that bugfix at the start or end of the patchset. Edit: RCHAR/RBYTES and WCHAR/WBYTES: The *CHAR metrics tell the number of bytes requested by the process for reading/writing through syscalls like read,pread,… while the *BYTES metrics tell the number of bytes that actually hit the physical media backing the storage. If you had a file fully in cache, then RCHAR would increase for every read, while RBYTES would remain unchanged. |
Add RBYTES, WBYTES, IO_READ_RATE, IO_WRITE_RATE, and IO_RATE process columns on Darwin. macOS has no /proc/<pid>/io, but proc_pid_rusage(pid, RUSAGE_INFO_V2, ...) provides ri_diskio_bytesread/ri_diskio_byteswritten. Rates are derived from the delta between consecutive scans, using the same formula and PROCESS_FLAG_IO gating as LinuxProcessTable_readIoFile. Field IDs, names, and titles match the Linux platform, so column configuration stays portable. macOS exposes only cumulative byte counters (no RCHAR/WCHAR/SYSCR/SYSCW/ CNCLWB, IO_PRIORITY, or PERCENT_*_DELAY), and the rusage of other users' processes requires root privileges, so those show N/A when unprivileged. The rate delta uses the monotonic clock, so wall-clock adjustments cannot skew the result; LinuxProcessTable_readIoFile still uses the realtime clock for this calculation (to be fixed separately). Signed-off-by: Oleksij Samorukov <[email protected]> Assisted-by: DeepSeek V4.1 Flash (opencode)
Add a second screen tab ("I/O") on Darwin, mirroring the Linux I/O tab,
showing the per-process disk I/O columns:
PID USER IO_RATE IO_READ_RATE IO_WRITE_RATE RBYTES WBYTES Command
Signed-off-by: Oleksij Samorukov <[email protected]>
Assisted-by: DeepSeek V4.1 Flash (opencode)
8aa9c05 to
eb99367
Compare
|
Thanks — reworded the first commit message per your suggestion (now No code changes; the tree is identical. |
Description
Mirrors the Linux I/O tab on Darwin:
macOS has no
/proc/<pid>/io, butproc_pid_rusage(pid, RUSAGE_INFO_V2, ...)provides
ri_diskio_bytesread/ri_diskio_byteswritten. Rates are deltasbetween scans, reusing the math and
PROCESS_FLAG_IOgating fromLinuxProcessTable_readIoFile. Field ids/names/titles match Linux, so columnconfig stays portable.
Limitations
RCHAR/WCHAR/SYSCR/SYSCW/CNCLWB,IO_PRIORITY, orPERCENT_*_DELAY.proc_pid_rusage()for other users' processes needs root; unprivileged theyshow
N/A(same ceiling as Linux withoutCAP_DAC_READ_SEARCH).N/A(macOS tracks I/O per process).Testing
-Werrorbuild of the changed files (Apple clang) on macOS.[I/O]tab populates and sorts byDISK R/W.