rusefi/firmware/controllers/engine_controller_misc.cpp

35 lines
632 B
C++
Raw Normal View History

2020-03-22 21:01:59 -07:00
/*
* @file engine_controller_misc.cpp
*
* @date Mar 22, 2020
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
2022-09-07 12:56:45 -07:00
static uint8_t nextThreadId = 0;
void threadInitHook(void* vtp) {
// No lock required, this is already under lock
auto tp = reinterpret_cast<thread_t*>(vtp);
tp->threadId = ++nextThreadId;
}
2020-03-22 21:01:59 -07:00
#if ENABLE_PERF_TRACE
void irqEnterHook() {
2020-03-22 21:01:59 -07:00
perfEventBegin(PE::ISR);
}
void irqExitHook() {
2020-03-22 21:01:59 -07:00
perfEventEnd(PE::ISR);
}
void contextSwitchHook() {
perfEventInstantGlobal(PE::ContextSwitch);
}
#else
void irqEnterHook() {}
void irqExitHook() {}
void contextSwitchHook() {}
2020-03-22 21:01:59 -07:00
#endif /* ENABLE_PERF_TRACE */