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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
extern crate ndarray;
use self::ndarray::{OwnedArray, Ix};
use std::f64;
pub type Mat<A> = OwnedArray<A, (Ix, Ix)>;
pub enum Profiler {
CacheGrind {
ir: f64,
i1mr: f64,
ilmr: f64,
dr: f64,
d1mr: f64,
dlmr: f64,
dw: f64,
d1mw: f64,
dlmw: f64,
data: Mat<f64>,
functs: Vec<String>,
},
CallGrind {
total_instructions: f64,
instructions: Vec<f64>,
functs: Vec<String>,
},
}
impl Profiler {
pub fn new_cachegrind() -> Profiler {
Profiler::CacheGrind {
ir: f64::NAN,
i1mr: f64::NAN,
ilmr: f64::NAN,
dr: f64::NAN,
d1mr: f64::NAN,
dlmr: f64::NAN,
dw: f64::NAN,
d1mw: f64::NAN,
dlmw: f64::NAN,
data: OwnedArray::zeros((2, 2)),
functs: Vec::new(),
}
}
pub fn new_callgrind() -> Profiler {
Profiler::CallGrind {
total_instructions: f64::NAN,
instructions: Vec::new(),
functs: Vec::new(),
}
}
}