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