Browse Source

longer running example

master
Jonathan Strong 6 years ago
parent
commit
a109ae29ca
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      examples/hist-interval.rs

+ 8
- 5
examples/hist-interval.rs View File

@@ -6,11 +6,11 @@ use std::thread;


use logging::hist::{Entry, HistLog, nanos}; use logging::hist::{Entry, HistLog, nanos};


const N_SECS: u64 = 300;
const N_SECS: u64 = 60 * 60;


fn main() { fn main() {
let start = Instant::now(); let start = Instant::now();
let mut a = HistLog::new("test", "a", Duration::from_millis(100));
let mut a = HistLog::new("test", "a", Duration::from_millis(1000));
let mut b = a.clone_with_tag("b"); let mut b = a.clone_with_tag("b");
let mut c = b.clone_with_tag("c"); let mut c = b.clone_with_tag("c");


@@ -30,7 +30,8 @@ fn main() {
if loop_time - start > Duration::from_secs(N_SECS) { break } if loop_time - start > Duration::from_secs(N_SECS) { break }


i += 1; i += 1;
if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
//if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
thread::sleep(Duration::new(0, 0));
} }
}); });


@@ -49,7 +50,8 @@ fn main() {


i += 1; i += 1;
//if i % 1_000 == 0 { thread::sleep(Duration::new(0, 0)); } //if i % 1_000 == 0 { thread::sleep(Duration::new(0, 0)); }
if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
//if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
thread::sleep(Duration::new(0, 0));
} }
}); });


@@ -67,7 +69,8 @@ fn main() {


i += 1; i += 1;
//if i % 100_000 == 0 { thread::sleep(Duration::from_millis(10)); } //if i % 100_000 == 0 { thread::sleep(Duration::from_millis(10)); }
if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
//if i % 100 == 0 { thread::sleep(Duration::new(0, 0)); }
thread::sleep(Duration::new(0, 0));
} }
} }



Loading…
Cancel
Save