Crates.io | precord |
lib.rs | precord |
version | 0.7.13 |
source | src |
created_at | 2021-12-10 05:27:33.779903 |
updated_at | 2024-08-08 13:46:29.03309 |
description | Command line tool for recording process or system performance data |
homepage | https://github.com/xiaopengli89/precord |
repository | https://github.com/xiaopengli89/precord |
max_upload_size | |
id | 495584 |
size | 227,525 |
Command line tool for recording process or system performance data.
Install with cargo
:
cargo install precord
precord -p 1203 -o result.svg
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 processthread
- Thread count of processsys_cpu
- CPU usage of systemsys_cpu_freq
- CPU frequency of systemsys_cpu_temp
- CPU temperature of systemsys_gpu
- GPU usage of systemsys_power
- Power usage of systemsys_npu_power
- Power usage of npu-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
--interactive
- Interactive mode--auto-save
- Interval of auto savingType :
during recording will enter the command mode, and press Esc
will back to recording. The supported commands are:
w
- Write(Save) outputq
- Exitwq
- Combination of w
and q
time
- modify time limit for recordingthread-list <PID>
- List threads and cpu usageA library for retrieving process and system performance data.
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(cpu_usage) = system.process_cpu_usage(1203) {
println!("Process({}) %CPU: {:.2}%", 1203, cpu_usage)
}
#[cfg(target_os = "windows")]
if let Some(gpu_usage) = system.process_gpu_usage(1203, GpuCalculation::Max) {
println!("Process({}) %GPU: {:.2}%", 1203, gpu_usage)
}
if let Some(sys_gpu_usage) = system.system_gpu_usage(GpuCalculation::Max) {
println!("System %GPU: {:.2}%", sys_gpu_usage);
}
}
macOS | Windows | Linux | |
---|---|---|---|
cpu | :white_check_mark: | :white_check_mark: | :white_check_mark: |
mem | :white_check_mark: | :white_check_mark: | :white_check_mark: |
alloc | :white_check_mark: | ||
gpu | :white_check_mark: | ||
vram | :white_check_mark: | ||
fps | :white_check_mark: | :white_check_mark: | |
net_in/net_out | :white_check_mark: | :white_check_mark: | |
disk_read/disk_write | :white_check_mark: | ||
kobject | :white_check_mark: | :white_check_mark: | |
thread | :white_check_mark: | :white_check_mark: | |
sys_cpu | :white_check_mark: | :white_check_mark: | :white_check_mark: |
sys_cpu_freq | :white_check_mark: | :white_check_mark: | :white_check_mark: |
sys_cpu_temp | :white_check_mark: | :white_check_mark: | |
sys_gpu | :white_check_mark: | :white_check_mark: | |
sys_power | :white_check_mark: | :white_check_mark: | |
sys_npu_power | :white_check_mark: |
macOS | Windows | Linux | |
---|---|---|---|
cpu | |||
mem | |||
alloc | |||
gpu | |||
vram | |||
fps | Administrator + get-task-allow | Administrator | |
net_in/net_out | Administrator | ||
disk_read/disk_write | |||
kobject | |||
thread | |||
sys_cpu | |||
sys_cpu_freq | Administrator | ||
sys_cpu_temp | |||
sys_gpu | |||
sys_power | |||
sys_npu_power | Administrator | ||
system processes (WindowServer, dwm.exe, etc.) |
Administrator | Administrator |