update readme - #12
Conversation
📝 WalkthroughWalkthroughThe README expands from a brief usage guide into comprehensive documentation for UniProc installation, CLI behavior, dashboard controls, metrics, output formats, limitations, troubleshooting, development workflows, project structure, and licensing. ChangesUniProc documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@readme.md`:
- Around line 147-159: Update the CSV header documentation and serializer to use
the canonical network field names network_received_bytes and
network_transmitted_bytes instead of the system_network_* variants, and add an
output-schema test covering the header and corresponding row columns.
- Around line 147-150: Update the README descriptions for network_received_bytes
and network_transmitted_bytes to state that they represent cumulative
system-wide interface counters, not bytes received or transmitted since the
preceding refresh; leave the disk metric descriptions unchanged.
- Around line 97-132: Update the README CSV example’s header to use
network_received_bytes and network_transmitted_bytes instead of the
system_network_* names, matching the fields emitted by the CSV output schema.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| ## CLI Reference | ||
|
|
||
| ```text | ||
| uniproc --pid <PID> [OPTIONS] | ||
| uniproc --name <NAME> [OPTIONS] | ||
| ``` | ||
|
|
||
| Exactly one target is required: | ||
|
|
||
| | Option | Description | | ||
| | --- | --- | | ||
| | `--pid <PID>` | Monitor the process with this process ID. | | ||
| | `--name <NAME>` | Monitor a process by exact process name. If multiple processes match, UniProc exits and prints the matching PIDs so you can choose one explicitly. | | ||
|
|
||
| General options: | ||
|
|
||
| | Option | Default | Description | | ||
| | --- | --- | --- | | ||
| | `--interval <MS>` | `1000` | Sampling interval in milliseconds. Must be at least `1`. | | ||
| | `--duration <SECONDS>` | none | Stop collection after this many seconds. Required when using `--csv` or `--json`. | | ||
| | `--csv <PATH>` | none | Write captured samples as CSV instead of starting the interactive dashboard. | | ||
| | `--json <PATH>` | none | Write captured samples as pretty JSON instead of starting the interactive dashboard. | | ||
| | `--help` | none | Print command help. | | ||
| | `--version` | none | Print the UniProc version. | | ||
|
|
||
| Export modes require `--duration` so the command has a defined end. Without `--csv` or `--json`, UniProc starts the interactive dashboard. | ||
|
|
||
| ## Dashboard Controls | ||
|
|
||
| | Key | Action | | ||
| | --- | --- | | ||
| | `p` | Pause or resume sampling. | | ||
| | `Space` | Pause or resume sampling. | | ||
| | `c` | Clear the in-memory dashboard history. | | ||
| | `q` | Quit and return collected samples to the caller. | | ||
| | `Esc` | Quit and return collected samples to the caller. | |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
fd -t f -e rs -0 | xargs -0 -r rg -n -C 5 \
'Parser|pid|name|interval|duration|csv|json|KeyCode|Esc|Space|clear|pause'Repository: imsudiproy/uniproc
Length of output: 24675
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- README CLI section ---'
sed -n '90,140p' readme.md
printf '%s\n' '--- main.rs ---'
cat -n src/main.rs
printf '%s\n' '--- monitor.rs ---'
cat -n src/core/monitor.rs
printf '%s\n' '--- TUI event loop ---'
sed -n '65,130p' src/output/tui.rs
printf '%s\n' '--- export writers ---'
cat -n src/output/csv.rs
cat -n src/output/json.rsRepository: imsudiproy/uniproc
Length of output: 12495
🌐 Web query:
clap Rust ArgGroup required args multiple default behavior
💡 Result:
In the Rust clap library, an ArgGroup allows you to group multiple arguments together to define specific validation rules [1][2]. The behavior of a required ArgGroup is determined by the interaction between the.required and.multiple settings [3][2]. Default Behavior and Settings: 1..multiple(false) (Default): By default, multiple is set to false [3][4]. When combined with.required(true), this enforces that one and only one argument from the group must be present at runtime [3][2]. Providing more than one argument from the group will result in an error [3][2]. 2..multiple(true): When set to true, this allows more than one argument from the group to be used [3][4]. When combined with.required(true), this enforces that at least one argument from the group must be present, but allows for multiple arguments to be used simultaneously [3][2]. Important Considerations: - Required Groups: When an ArgGroup is marked as required, at least one argument from that group must be present at runtime [2]. If all arguments in the group have default values, the group may behave as if it is always present, which can sometimes lead to issues if requirements are not met or conflicts arise [5][6]. - Conflicting Rules: Setting a group as required is subject to other argument rules; conflicting arguments or overrides can take precedence over the required status [7][2]. - Interaction with Defaults: Be aware that if arguments within a group have default values assigned, it may trigger validation errors regarding the group's requirements, as clap interprets the presence of default values as the argument being "used" [5][6]. By using.multiple(true) in conjunction with.required(true), you change the restriction from "exactly one" to "at least one," providing flexibility when multiple related flags should be accepted together [3][2].
Citations:
- 1: https://github.com/clap-rs/clap/blob/master/src/_tutorial.rs
- 2: https://docs.rs/clap/2.29.3/clap/struct.ArgGroup.html
- 3: https://docs.rs/clap/latest/clap/struct.ArgGroup.html
- 4: clap-rs/clap@33689ac
- 5: requires_all ArgGroup with a default, causes the entire ArgGroup to be required clap-rs/clap#1586
- 6: ArgGroup to require one and only one argument; all default clap-rs/clap#3899
- 7: https://docs.rs/clap/latest/clap/struct.Arg.html
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- README metrics section ---'
sed -n '135,190p' readme.md
printf '%s\n' '--- ProcessInfo fields ---'
sed -n '1,35p' src/datasources/cpu_mem.rs
printf '%s\n' '--- CSV header and row fields ---'
sed -n '6,28p' src/output/csv.rsRepository: imsudiproy/uniproc
Length of output: 4339
Align the documented CSV header with the emitted schema. The README uses system_network_received_bytes and system_network_transmitted_bytes, but the output fields are network_received_bytes and network_transmitted_bytes. Update the CSV example to match the generated header.
🤖 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 `@readme.md` around lines 97 - 132, Update the README CSV example’s header to
use network_received_bytes and network_transmitted_bytes instead of the
system_network_* names, matching the fields emitted by the CSV output schema.
| | `disk_read_bytes` | bytes | Bytes read since the preceding process refresh, platform dependent. | | ||
| | `disk_written_bytes` | bytes | Bytes written since the preceding process refresh, platform dependent. | | ||
| | `network_received_bytes` | bytes | System-wide network bytes received since the preceding refresh. | | ||
| | `network_transmitted_bytes` | bytes | System-wide network bytes transmitted since the preceding refresh. | |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
fd -t f -e rs -0 | xargs -0 -r rg -n -C 6 \
'disk_read_bytes|disk_written_bytes|network_received_bytes|network_transmitted_bytes|read_bytes|written_bytes|refresh|delta|File::create|OpenOptions'Repository: imsudiproy/uniproc
Length of output: 10046
Correct the network metric descriptions.
disk_read_bytes and disk_written_bytes are refresh deltas. The network fields sum cumulative interface counters, so they are not deltas since the preceding refresh. Update the README or compute network deltas before export. File::create truncates existing output files as documented.
🤖 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 `@readme.md` around lines 147 - 150, Update the README descriptions for
network_received_bytes and network_transmitted_bytes to state that they
represent cumulative system-wide interface counters, not bytes received or
transmitted since the preceding refresh; leave the disk metric descriptions
unchanged.
| | `disk_read_bytes` | bytes | Bytes read since the preceding process refresh, platform dependent. | | ||
| | `disk_written_bytes` | bytes | Bytes written since the preceding process refresh, platform dependent. | | ||
| | `network_received_bytes` | bytes | System-wide network bytes received since the preceding refresh. | | ||
| | `network_transmitted_bytes` | bytes | System-wide network bytes transmitted since the preceding refresh. | | ||
|
|
||
| The dashboard formats byte values for readability. Export files keep raw byte values. | ||
|
|
||
| ## CSV Output | ||
|
|
||
| CSV export writes a header row followed by one row per sample: | ||
|
|
||
| ```text | ||
| timestamp_ms,pid,name,cpu_percent,memory_bytes,system_memory_bytes,virtual_memory_bytes,disk_read_bytes,disk_written_bytes,system_network_received_bytes,system_network_transmitted_bytes |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
fd -t f -e rs -0 | xargs -0 -r rg -n -C 6 \
'network_received_bytes|network_transmitted_bytes|system_network_received_bytes|system_network_transmitted_bytes|serialize|write_record'Repository: imsudiproy/uniproc
Length of output: 5098
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- README schema and related sections ---'
sed -n '125,205p' readme.md
printf '%s\n' '--- Output modules and tests ---'
fd -t f | rg '(^|/)(csv|json|output|readme|test|tests)' | sort
rg -n -C 5 'serde_json|to_string|write\(|CSV|csv|network_received_bytes|network_transmitted_bytes' src tests 2>/dev/null || trueRepository: imsudiproy/uniproc
Length of output: 13577
Use the canonical network field names in the CSV header.
The CSV serializer writes network_received_bytes and network_transmitted_bytes, but its header declares system_network_received_bytes and system_network_transmitted_bytes. Update the header and add an output-schema test.
🤖 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 `@readme.md` around lines 147 - 159, Update the CSV header documentation and
serializer to use the canonical network field names network_received_bytes and
network_transmitted_bytes instead of the system_network_* variants, and add an
output-schema test covering the header and corresponding row columns.
Summary by CodeRabbit