Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2189 | - | 1 | #include <inttypes.h> |
2 | #include <string.h> |
||
3 | #include "profiler.h" |
||
4 | |||
5 | uint8_t currentProfiledActivity; |
||
6 | volatile uint32_t totalProfilerHits; |
||
7 | volatile uint16_t activitiesTimerHits[16]; |
||
8 | |||
9 | char profilerLabel0[] PROGMEM = "Unaccounted"; |
||
10 | char profilerLabel1[] PROGMEM = "AnalogUpd"; |
||
11 | char profilerLabel2[] PROGMEM = "MatrixUpd1"; |
||
12 | char profilerLabel3[] PROGMEM = "MatrixUpd2"; |
||
13 | char profilerLabel4[] PROGMEM = "Normalize1"; |
||
14 | char profilerLabel5[] PROGMEM = "Normalize2"; |
||
15 | char profilerLabel6[] PROGMEM = "DriftCorr"; |
||
16 | char profilerLabel7[] PROGMEM = "CheckMatrix"; |
||
17 | char profilerLabel8[] PROGMEM = "EulerAngles"; |
||
18 | char profilerLabel9[] PROGMEM = "AnglesOutput"; |
||
19 | char profilerLabel10[] PROGMEM = "ControlMixer"; |
||
20 | char profilerLabel11[] PROGMEM = "Commands"; |
||
21 | char profilerLabel12[] PROGMEM = "FlightControl"; |
||
22 | char profilerLabel13[] PROGMEM = "UART"; |
||
23 | char profilerLabel14[] PROGMEM = "Outputs"; |
||
24 | char profilerLabel15[] PROGMEM = ""; |
||
25 | |||
26 | PGM_P PROFILER_LABELS[] PROGMEM = { |
||
27 | profilerLabel0, |
||
28 | profilerLabel1, |
||
29 | profilerLabel2, |
||
30 | profilerLabel3, |
||
31 | profilerLabel4, |
||
32 | profilerLabel5, |
||
33 | profilerLabel6, |
||
34 | profilerLabel7, |
||
35 | profilerLabel8, |
||
36 | profilerLabel9, |
||
37 | profilerLabel10, |
||
38 | profilerLabel11, |
||
39 | profilerLabel12, |
||
40 | profilerLabel13, |
||
41 | profilerLabel14, |
||
42 | profilerLabel15 |
||
43 | }; |
||
44 | |||
45 | void setCurrentProfiledActivity(uint8_t what) { |
||
46 | currentProfiledActivity = what; |
||
47 | } |
||
48 | |||
49 | void reset(void) { |
||
50 | memset((uint8_t*)&activitiesTimerHits, 0, sizeof(activitiesTimerHits)); |
||
51 | totalProfilerHits = 0; |
||
52 | } |
||
53 | |||
54 | void profiler_scoreTimerHit(void) { |
||
55 | activitiesTimerHits[currentProfiledActivity]++; |
||
56 | totalProfilerHits++; |
||
57 | } |