Giter Site home page Giter Site logo

precord's Introduction

precord

crates.io docs.rs Minimum rustc version

Command line tool for recording process or system performance data.

Installation

Install with cargo:

cargo install precord

Usage

precord -p 1203 -o result.svg

Options

precord -h
  • -c / --category - categories for recording, possible values:
    • cpu - CPU usage of process
    • mem - Memory usage of process
    • alloc - Allocation of process
    • gpu - GPU usage of process
    • vram - VRAM usage of process
    • fps - Frame rate of process
    • net_in/net_out - Network recv/send of process
    • disk_read/disk_write - Disk read/write of process
    • kobject - Kernel object count of process
    • thread - Thread count of process
    • sys_cpu - CPU usage of system
    • sys_cpu_freq - CPU frequency of system
    • sys_cpu_temp - CPU temperature of system
    • sys_gpu - GPU usage of system
    • sys_power - Power usage of system
    • sys_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 saving

Command Mode

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

Sub Commands

  • thread-list <PID> - List threads and cpu usage

precord-core

A 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);
  }
}

Supported Platforms

macOS Windows Linux
cpu
mem
alloc
gpu
vram
fps
net_in/net_out
disk_read/disk_write
kobject
thread
sys_cpu
sys_cpu_freq
sys_cpu_temp
sys_gpu
sys_power
sys_npu_power

Privileges

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

TODO

Related projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.