make test
Read example.cpp
, only 36 lines of code.
f() {
for (int i = 0; i < 1e1; i ++) {
time_nested("x", [&]() {
for (int j = 0; j < loop_count; j ++) {
x += (i + 1) * (j + 1);
}
});
time_nested("y", [&]() {
x = x ^ (x + x);
this_thread::sleep_for(chrono::milliseconds(10));
});
}
}
time_nested("b", [&]() {
for (int i = 0; i < 1e1; i++) {
f(1e5);
}
});
/----------------------------------------\
Timer -> b:
Average Time : 1.02469
Total Time : 1.02469
Proportion:
-> x : 0.00924139
-> y : 0.990575
-> other : 0.00018401
Details: 1.024692
Occurance: 1
\----------------------------------------/
/----------------------------------------\
Timer -> b -> x:
Average Time : 9.46959e-05
Total Time : 0.00946959
Proportion:
-> other : 1
Details: 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000109 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000113 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000111 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094 0.000094
Occurance: 100
\----------------------------------------/
/----------------------------------------\
Timer -> b -> y:
Average Time : 0.0101503
Total Time : 1.01503
Proportion:
-> other : 1
Details: 0.010162 0.010152 0.010149 0.010144 0.010163 0.010163 0.010128 0.010140 0.010161 0.010158 0.010159 0.010163 0.010153 0.010142 0.010142 0.010172 0.010149 0.010143 0.010167 0.010164 0.010139 0.010140 0.010133 0.010168 0.010158 0.010127 0.010124 0.010127 0.010159 0.010150 0.010148 0.010159 0.010142 0.010166 0.010151 0.010147 0.010146 0.010149 0.010146 0.010144 0.010143 0.010145 0.010161 0.010128 0.010128 0.010139 0.010163 0.010147 0.010145 0.010141 0.010164 0.010142 0.010151 0.010162 0.010139 0.010172 0.010146 0.010150 0.010143 0.010164 0.010146 0.010161 0.010132 0.010160 0.010147 0.010152 0.010164 0.010159 0.010147 0.010168 0.010139 0.010145 0.010150 0.010141 0.010149 0.010140 0.010159 0.010164 0.010132 0.010128 0.010142 0.010140 0.010164 0.010155 0.010155 0.010163 0.010157 0.010148 0.010158 0.010150 0.010149 0.010151 0.010148 0.010161 0.010161 0.010136 0.010169 0.010161 0.010155 0.010158
Occurance: 100
\----------------------------------------/