1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pub mod error;
pub mod name;
pub mod attributes;
pub mod input;
pub mod output;
pub mod locking;
pub mod clock;
pub mod void;
pub mod proxy;
pub mod label;
pub mod pcg32;
pub mod scheduler;
pub mod metrics;
pub type MetricValue = isize;
pub trait Flush {
fn flush(&self) -> error::Result<()> {
Ok(())
}
}
#[cfg(test)]
pub mod test {
use super::*;
use super::input::*;
#[test]
fn test_to_void() {
let c = void::Void::metrics().input();
let m = c.new_metric("test".into(), input::InputKind::Marker);
m.write(33, labels![]);
}
}
#[cfg(feature = "bench")]
pub mod bench {
use super::input::*;
use super::clock::*;
use super::super::bucket::atomic::*;
use test;
#[bench]
fn get_instant(b: &mut test::Bencher) {
b.iter(|| test::black_box(TimeHandle::now()));
}
#[bench]
fn time_bench_direct_dispatch_event(b: &mut test::Bencher) {
let metrics = AtomicBucket::new();
let marker = metrics.marker("aaa");
b.iter(|| test::black_box(marker.mark()));
}
}