Crates.io | pmapi-rs |
lib.rs | pmapi-rs |
version | 0.1.0 |
source | src |
created_at | 2024-07-17 02:20:15.525965 |
updated_at | 2024-07-17 02:20:15.525965 |
description | Safe and idiomatic wrapper for the Performance Metrics API (PMAPI) |
homepage | |
repository | https://github.com/jfernandez/pmapi-rs |
max_upload_size | |
id | 1305752 |
size | 34,025 |
This Rust crate provides a wrapper for the Performance Metrics API (PMAPI), allowing you to fetch and work with performance metrics in a safe and idiomatic way.
Here's a quick example of how to use this wrapper to fetch a raw metric result:
let context = Context::new(ContextType::Host, "localhost").unwrap();
let metric_id = lookup_name("kernel.all.cpu.user").unwrap();
let result = fetch_raw(metric_id).unwrap();
let vset = unsafe { *(result.vset[0]) };
println!("kernel.all.cpu.user: {}", vset.value);