make sampling period configurable
This commit is contained in:
parent
be897c3681
commit
81794de504
|
|
@ -1,3 +1,6 @@
|
||||||
|
[global]
|
||||||
|
period = 1
|
||||||
|
|
||||||
[[graph]]
|
[[graph]]
|
||||||
name = "cpu load"
|
name = "cpu load"
|
||||||
path = "cpu.png"
|
path = "cpu.png"
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,15 @@ use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
pub global: Global,
|
||||||
pub graph: Vec<GraphConfig>,
|
pub graph: Vec<GraphConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
pub struct Global {
|
||||||
|
pub period: f32,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct GraphConfig {
|
pub struct GraphConfig {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ fn main() {
|
||||||
if let Err(e) = r {
|
if let Err(e) = r {
|
||||||
println!("{}", e.to_string());
|
println!("{}", e.to_string());
|
||||||
}
|
}
|
||||||
thread::sleep(time::Duration::from_secs(1));
|
thread::sleep(time::Duration::from_secs_f32(config.global.period));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
panic!("sock not found!");
|
panic!("sock not found!");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue