executor runtime stats
This commit is contained in:
parent
7ac05a804a
commit
1ae91b98d0
|
@ -72,6 +72,7 @@ extern bool main_loop_started;
|
||||||
#include "flash_main.h"
|
#include "flash_main.h"
|
||||||
#include "max31855.h"
|
#include "max31855.h"
|
||||||
#include "vehicle_speed.h"
|
#include "vehicle_speed.h"
|
||||||
|
#include "SingleTimerExecutor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool subscription[(int) RO_LAST_ELEMENT];
|
static bool subscription[(int) RO_LAST_ELEMENT];
|
||||||
|
@ -672,6 +673,10 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
int rpm = 0;
|
int rpm = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
|
executorStatistics();
|
||||||
|
#endif
|
||||||
|
|
||||||
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
float coolant = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float coolant = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
float intake = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
float intake = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
#include "efitime.h"
|
#include "efitime.h"
|
||||||
#include "efilib2.h"
|
#include "efilib2.h"
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
#include "microsecond_timer.h"
|
#include "microsecond_timer.h"
|
||||||
|
#include "tunerstudio_configuration.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (EFI_SIGNAL_EXECUTOR_ONE_TIMER && EFI_PROD_CODE )|| defined(__DOXYGEN__)
|
#if (EFI_SIGNAL_EXECUTOR_ONE_TIMER && EFI_PROD_CODE )|| defined(__DOXYGEN__)
|
||||||
|
@ -52,6 +53,7 @@ static void executorCallback(void *arg) {
|
||||||
|
|
||||||
Executor::Executor() {
|
Executor::Executor() {
|
||||||
reentrantFlag = false;
|
reentrantFlag = false;
|
||||||
|
doExecuteCounter = scheduleCounter = timerCallbackCounter = 0;
|
||||||
/**
|
/**
|
||||||
* todo: a good comment
|
* todo: a good comment
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +62,7 @@ Executor::Executor() {
|
||||||
|
|
||||||
void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback,
|
void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback,
|
||||||
void *param) {
|
void *param) {
|
||||||
|
scheduleCounter++;
|
||||||
// if (delayUs < 0) {
|
// if (delayUs < 0) {
|
||||||
// firmwareError(OBD_PCM_Processor_Fault, "Negative delayUs %s: %d", prefix, delayUs);
|
// firmwareError(OBD_PCM_Processor_Fault, "Negative delayUs %s: %d", prefix, delayUs);
|
||||||
// return;
|
// return;
|
||||||
|
@ -85,6 +88,7 @@ void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schf
|
||||||
}
|
}
|
||||||
|
|
||||||
void Executor::onTimerCallback() {
|
void Executor::onTimerCallback() {
|
||||||
|
timerCallbackCounter++;
|
||||||
bool alreadyLocked = lockAnyContext();
|
bool alreadyLocked = lockAnyContext();
|
||||||
doExecute();
|
doExecute();
|
||||||
scheduleTimerCallback();
|
scheduleTimerCallback();
|
||||||
|
@ -96,6 +100,7 @@ void Executor::onTimerCallback() {
|
||||||
* this private method is executed under lock
|
* this private method is executed under lock
|
||||||
*/
|
*/
|
||||||
void Executor::doExecute() {
|
void Executor::doExecute() {
|
||||||
|
doExecuteCounter++;
|
||||||
/**
|
/**
|
||||||
* Let's execute actions we should execute at this point.
|
* Let's execute actions we should execute at this point.
|
||||||
* reentrantFlag takes care of the use case where the actions we are executing are scheduling
|
* reentrantFlag takes care of the use case where the actions we are executing are scheduling
|
||||||
|
@ -162,10 +167,21 @@ void scheduleByTime(scheduling_s *scheduling, efitimeus_t time, schfunc_t callba
|
||||||
|
|
||||||
void initSignalExecutorImpl(void) {
|
void initSignalExecutorImpl(void) {
|
||||||
globalTimerCallback = executorCallback;
|
globalTimerCallback = executorCallback;
|
||||||
#if EFI_PROD_CODE
|
|
||||||
initMicrosecondTimer();
|
initMicrosecondTimer();
|
||||||
#endif /* EFI_PROD_CODE */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
|
#include "engine.h"
|
||||||
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
|
|
||||||
|
void executorStatistics() {
|
||||||
|
if (engineConfiguration->debugMode == DM_18) {
|
||||||
|
tsOutputChannels.debugIntField1 = instance.timerCallbackCounter;
|
||||||
|
tsOutputChannels.debugIntField2 = instance.doExecuteCounter;
|
||||||
|
tsOutputChannels.debugIntField3 = instance.scheduleCounter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* EFI_SIGNAL_EXECUTOR_ONE_TIMER */
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ public:
|
||||||
Executor();
|
Executor();
|
||||||
void scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param);
|
void scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param);
|
||||||
void onTimerCallback();
|
void onTimerCallback();
|
||||||
|
int timerCallbackCounter;
|
||||||
|
int scheduleCounter;
|
||||||
|
int doExecuteCounter;
|
||||||
private:
|
private:
|
||||||
EventQueue queue;
|
EventQueue queue;
|
||||||
bool reentrantFlag;
|
bool reentrantFlag;
|
||||||
|
@ -24,5 +27,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void initSignalExecutorImpl(void);
|
void initSignalExecutorImpl(void);
|
||||||
|
void executorStatistics();
|
||||||
|
|
||||||
#endif /* SINGLETIMEREXECUTOR_H_ */
|
#endif /* SINGLETIMEREXECUTOR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue