Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/* |
2 |
|
|
|
* @file engine_controller_misc.cpp |
3 |
|
|
|
* |
4 |
|
|
|
* @date Mar 22, 2020 |
5 |
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020 |
6 |
|
|
|
*/ |
7 |
|
|
|
|
8 |
|
|
|
#include "pch.h" |
9 |
|
|
|
|
10 |
|
|
|
static uint8_t nextThreadId = 0; |
11 |
|
|
✗ |
void threadInitHook(void* vtp) { |
12 |
|
|
|
// No lock required, this is already under lock |
13 |
|
|
✗ |
auto tp = reinterpret_cast<thread_t*>(vtp); |
14 |
|
|
✗ |
tp->threadId = ++nextThreadId; |
15 |
|
|
✗ |
} |
16 |
|
|
|
|
17 |
|
|
|
#if ENABLE_PERF_TRACE |
18 |
|
|
|
void irqEnterHook() { |
19 |
|
|
|
perfEventBegin(PE::ISR); |
20 |
|
|
|
} |
21 |
|
|
|
|
22 |
|
|
|
void irqExitHook() { |
23 |
|
|
|
perfEventEnd(PE::ISR); |
24 |
|
|
|
} |
25 |
|
|
|
|
26 |
|
|
|
void contextSwitchHook() { |
27 |
|
|
|
perfEventInstantGlobal(PE::ContextSwitch); |
28 |
|
|
|
} |
29 |
|
|
|
|
30 |
|
|
|
#else |
31 |
|
|
✗ |
void irqEnterHook() {} |
32 |
|
|
✗ |
void irqExitHook() {} |
33 |
|
|
✗ |
void contextSwitchHook() {} |
34 |
|
|
|
#endif /* ENABLE_PERF_TRACE */ |
35 |
|
|
|
|