Command line tool for recording process or system performance data.
Install with cargo
:
shell
cargo install precord
shell
precord -p 1203 -o result.svg
shell
precord -h
-c / --category
- categories for recording, possible values:
cpu
- CPU usage of processmem
- Memory usage of processalloc
- Allocation of processgpu
- GPU usage of processvram
- VRAM usage of processfps
- Frame rate of processnet_in/net_out
- Network recv/send of processdisk_read/disk_write
- Disk read/write of processkobject
- Kernel object count of processsys_cpu
- CPU usage of systemsys_cpu_freq
- CPU frequency of systemsys_cpu_temp
- CPU temperature of systemsys_gpu
- GPU usage of system-p / --process
- ID of processes--name
- Name of processes-o / --output
- Specify the output file, possible extensions:
.svg
.html
.json
.csv
-i / --interval
- Interval for recording-n
- Count for recording--time
- Time limit for recording, e.g., --time 1h30m59s
-r / --recurse-children
- Flag to recurse child processes--skip
- Number of skip records--gpu-calc
- Gpu calculation, possible values:
max
sum
Type :
during recording will enter the command mode, and press Esc
will back to recording. The supported commands are:
- w
- Write(Save) output
- q
- Exit
- wq
- Combination of w
and q
- time
- modify time limit for recording
thread-list <PID>
- List threads and cpu usageA library for retrieving process and system performance data.
```rust use precord_core::{Features, GpuCalculation, System}; use std::thread; use std::time::Duration;
fn main() { let mut system = System::new(Features::PROCESS || Features::GPU, [1203]).unwrap(); thread::sleep(Duration::from_secs(1)); system.update();
if let Some(cpuusage) = system.processcpuusage(1203) { println!("Process({}) %CPU: {:.2}%", 1203, cpuusage) }
#[cfg(targetos = "windows")] if let Some(gpuusage) = system.processgpuusage(1203, GpuCalculation::Max) { println!("Process({}) %GPU: {:.2}%", 1203, gpu_usage) }
if let Some(sysgpuusage) = system.systemgpuusage(GpuCalculation::Max) { println!("System %GPU: {:.2}%", sysgpuusage); } } ```
| | macOS | Windows | Linux | |----------------------|--------------------|--------------------|--------------------| | cpu | :whitecheckmark: | :whitecheckmark: | :whitecheckmark: | | mem | :whitecheckmark: | :whitecheckmark: | :whitecheckmark: | | alloc | | :whitecheckmark: | | | gpu | | :whitecheckmark: | | | vram | | :whitecheckmark: | | | fps | :whitecheckmark: | :whitecheckmark: | | | netin/netout | :whitecheckmark: | :whitecheckmark: | | | diskread/diskwrite | :whitecheckmark: | | | | kobject | :whitecheckmark: | :whitecheckmark: | | | syscpu | :whitecheckmark: | :whitecheckmark: | :whitecheckmark: | | syscpufreq | :whitecheckmark: | :whitecheckmark: | :whitecheckmark: | | syscputemp | :whitecheckmark: | :whitecheckmark: | | | sysgpu | :whitecheckmark: | :whitecheckmark: | |
| | macOS | Windows | Linux |
|----------------------------------------------------|--------------------------------|---------------|-------|
| cpu | | | |
| mem | | | |
| alloc | | | |
| gpu | | | |
| vram | | | |
| fps | Administrator + get-task-allow | Administrator | |
| netin/netout | | Administrator | |
| diskread/diskwrite | | | |
| kobject | | | |
| syscpu | | | |
| syscpufreq | Administrator | | |
| syscputemp | | | |
| sysgpu | | | |
| system processes
(WindowServer, dwm.exe, etc.) | Administrator | Administrator | |