-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfiler.hpp
47 lines (42 loc) · 1.36 KB
/
Profiler.hpp
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
#ifndef PROFILER_INCLUDED
#define PROFILER_INCLUDED
enum PF {
PF_PIXELS,
PF_EUCLIDIAN,
PF_EUCLIDIAN_MUTATE,
PF_HARMONY,
PF_BPM,
PF_ENVELOPES,
PF_MIDI_OUT,
PF_INTEREST,
PF_MAX
};
class profiler {
unsigned long time[PF::PF_MAX];
unsigned long count[PF::PF_MAX];
public:
void reset() {
for (int i = 0 ; i < PF::PF_MAX; i ++) {
time[i] = 0;
count[i] = 0;
}
}
void l(int proftype, unsigned long length) {
time[proftype] += length;
count[proftype]++;
}
void output() {
Serial.printf("profiler:[ ");
Serial.printf("PIX:%i@%i | ", count[PF::PF_PIXELS], time[PF::PF_PIXELS]);
Serial.printf("EUC:%i@%i | ", count[PF::PF_EUCLIDIAN], time[PF::PF_EUCLIDIAN]);
Serial.printf("MUT:%i@%i | ", count[PF::PF_EUCLIDIAN_MUTATE], time[PF::PF_EUCLIDIAN_MUTATE]);
Serial.printf("HAR:%i@%i | ", count[PF::PF_HARMONY], time[PF::PF_HARMONY]);
Serial.printf("BPM:%i@%i | ", count[PF::PF_BPM], time[PF::PF_BPM]);
Serial.printf("ENV:%i@%i | ", count[PF::PF_ENVELOPES], time[PF::PF_ENVELOPES]);
Serial.printf("MDO:%i@%i | ", count[PF::PF_MIDI_OUT], time[PF::PF_MIDI_OUT]);
Serial.printf("INT:%i@%i | ", count[PF::PF_INTEREST], time[PF::PF_INTEREST]);
Serial.printf(" ]\n");
}
};
profiler pf = profiler();
#endif