{"id":20467213,"url":"https://github.com/xiaopengli89/precord","last_synced_at":"2025-04-04T21:07:13.291Z","repository":{"id":37757365,"uuid":"385604314","full_name":"xiaopengli89/precord","owner":"xiaopengli89","description":"Command line tool for recording process or system performance data.","archived":false,"fork":false,"pushed_at":"2025-02-20T13:55:45.000Z","size":681,"stargazers_count":52,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T20:06:52.504Z","etag":null,"topics":["command-line-tool","gpu","performance-monitoring","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaopengli89.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-13T12:57:07.000Z","updated_at":"2025-02-20T13:55:48.000Z","dependencies_parsed_at":"2024-07-19T13:59:56.026Z","dependency_job_id":null,"html_url":"https://github.com/xiaopengli89/precord","commit_stats":{"total_commits":358,"total_committers":3,"mean_commits":"119.33333333333333","dds":0.005586592178770999,"last_synced_commit":"8f69b3d56f2e65bc481066d0bc9c5d63bb60bd4b"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaopengli89%2Fprecord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaopengli89%2Fprecord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaopengli89%2Fprecord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaopengli89%2Fprecord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaopengli89","download_url":"https://codeload.github.com/xiaopengli89/precord/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249524,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","gpu","performance-monitoring","rust"],"created_at":"2024-11-15T13:27:42.171Z","updated_at":"2025-04-04T21:07:13.267Z","avatar_url":"https://github.com/xiaopengli89.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# precord\n\n[![crates.io](https://img.shields.io/crates/v/precord.svg)](https://crates.io/crates/precord)\n[![docs.rs](https://docs.rs/precord/badge.svg)](https://docs.rs/precord)\n![Minimum rustc version](https://img.shields.io/badge/rustc-1.64+-green.svg)\n\nCommand line tool for recording process or system performance data.\n\n\u003cimg src=\"asset/Chrome.svg\" width=\"480\"\u003e\u003c/img\u003e\n\n## Installation\n\nInstall with `cargo`:\n\n```shell\ncargo install precord\n```\n\n## Usage\n\n```shell\nprecord -p 1203 -o result.svg\n```\n\n### Options\n\n```shell\nprecord -h\n```\n\n- `-c / --category` - categories for recording, possible values:\n  - `cpu` - CPU usage of process\n  - `mem` - Memory usage of process\n  - `alloc` - Allocation of process\n  - `gpu` - GPU usage of process\n  - `vram` - VRAM usage of process\n  - `fps` - Frame rate of process\n  - `net_in/net_out` - Network recv/send of process\n  - `disk_read/disk_write` - Disk read/write of process\n  - `kobject` - Kernel object count of process\n  - `thread` - Thread count of process\n  - `sys_cpu` - CPU usage of system\n  - `sys_cpu_freq` - CPU frequency of system\n  - `sys_cpu_temp` - CPU temperature of system\n  - `sys_gpu` - GPU usage of system\n  - `sys_power` - Power usage of system\n  - `sys_npu_power` - Power usage of npu\n- `-p / --process` - ID of processes\n- `--name` - Name of processes\n- `-o / --output` - Specify the output file, possible extensions:\n  - `.svg`\n  - `.html`\n  - `.json`\n  - `.csv`\n- `-i / --interval` - Interval for recording\n- `-n` - Count for recording\n- `--time` - Time limit for recording, e.g., `--time 1h30m59s`\n- `-r / --recurse-children` - Flag to recurse child processes\n- `--skip` - Number of skip records\n- `--gpu-calc` - Gpu calculation, possible values:\n  - `max`\n  - `sum`\n- `--interactive` - Interactive mode\n- `--auto-save` - Interval of auto saving\n\n### Command Mode\nType `:` during recording will enter the command mode, and press `Esc` will back to recording. The supported commands are:\n- `w` - Write(Save) output\n- `q` - Exit\n- `wq` - Combination of `w` and `q` \n- `time` - modify time limit for recording\n\n### Sub Commands\n\n- `thread-list \u003cPID\u003e` - List threads and cpu usage\n\n## precord-core\n\nA library for retrieving process and system performance data.\n\n```rust\nuse precord_core::{Features, GpuCalculation, System};\nuse std::thread;\nuse std::time::Duration;\n\nfn main() {\n  let mut system = System::new(Features::PROCESS || Features::GPU, [1203]).unwrap();\n  thread::sleep(Duration::from_secs(1));\n  system.update();\n\n  if let Some(cpu_usage) = system.process_cpu_usage(1203) {\n    println!(\"Process({}) %CPU: {:.2}%\", 1203, cpu_usage)\n  }\n  \n  #[cfg(target_os = \"windows\")]\n  if let Some(gpu_usage) = system.process_gpu_usage(1203, GpuCalculation::Max) {\n    println!(\"Process({}) %GPU: {:.2}%\", 1203, gpu_usage)\n  }\n  \n  if let Some(sys_gpu_usage) = system.system_gpu_usage(GpuCalculation::Max) {\n    println!(\"System %GPU: {:.2}%\", sys_gpu_usage);\n  }\n}\n```\n\n## Supported Platforms\n\n|                      | macOS              | Windows            | Linux              |\n|----------------------|--------------------|--------------------|--------------------|\n| cpu                  | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| mem                  | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| alloc                |                    | :white_check_mark: |                    |\n| gpu                  |                    | :white_check_mark: |                    |\n| vram                 |                    | :white_check_mark: |                    |\n| fps                  | :white_check_mark: | :white_check_mark: |                    |\n| net_in/net_out       | :white_check_mark: | :white_check_mark: |                    |\n| disk_read/disk_write | :white_check_mark: |                    |                    |\n| kobject              | :white_check_mark: | :white_check_mark: |                    |\n| thread               | :white_check_mark: | :white_check_mark: |                    |\n| sys_cpu              | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| sys_cpu_freq         | :white_check_mark: | :white_check_mark: | :white_check_mark: |\n| sys_cpu_temp         | :white_check_mark: | :white_check_mark: |                    |\n| sys_gpu              | :white_check_mark: | :white_check_mark: |                    |\n| sys_power            | :white_check_mark: | :white_check_mark: |                    |\n| sys_npu_power        | :white_check_mark: |                    |                    |\n\n## Privileges\n\n|                                                    | macOS                          | Windows       | Linux |\n|----------------------------------------------------|--------------------------------|---------------|-------|\n| cpu                                                |                                |               |       |\n| mem                                                |                                |               |       |\n| alloc                                              |                                |               |       |\n| gpu                                                |                                |               |       |\n| vram                                               |                                |               |       |\n| fps                                                | Administrator + get-task-allow | Administrator |       |\n| net_in/net_out                                     |                                | Administrator |       |\n| disk_read/disk_write                               |                                |               |       |\n| kobject                                            |                                |               |       |\n| thread                                             |                                |               |       |\n| sys_cpu                                            |                                |               |       |\n| sys_cpu_freq                                       | Administrator                  |               |       |\n| sys_cpu_temp                                       |                                |               |       |\n| sys_gpu                                            |                                |               |       |\n| sys_power                                          |                                |               |       |\n| sys_npu_power                                      | Administrator                  |               |       |\n| system processes\u003cbr/\u003e(WindowServer, dwm.exe, etc.) | Administrator                  | Administrator |       |\n\n\n## TODO\n\n## Related projects\n\n- Rust\n  - [sysinfo]\n  - [heim]\n  - [rust-psutil]\n- Go\n  - [gopsutil]\n- Python\n  - [psutil]\n\n[sysinfo]: https://github.com/GuillaumeGomez/sysinfo\n[heim]: https://github.com/heim-rs/heim\n[rust-psutil]: https://github.com/rust-psutil/rust-psutil\n[gopsutil]: https://github.com/shirou/gopsutil\n[psutil]: https://github.com/giampaolo/psutil\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaopengli89%2Fprecord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaopengli89%2Fprecord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaopengli89%2Fprecord/lists"}