better names

This commit is contained in:
rusefi 2017-05-21 10:25:35 -04:00
parent a3919be9bd
commit 67a28c081f
5 changed files with 46 additions and 29 deletions

View File

@ -155,16 +155,19 @@ char *getWarning(void) {
}
uint32_t lastLockTime;
uint32_t maxLockTime = 0;
/**
* Maximum time before requesting lock and releasing lock at the end of critical section
*/
uint32_t maxLockedDuration = 0;
void onLockHook(void) {
lastLockTime = GET_TIMESTAMP();
}
void onUnlockHook(void) {
uint32_t t = GET_TIMESTAMP() - lastLockTime;
if (t > maxLockTime) {
maxLockTime = t;
uint32_t lockedDuration = GET_TIMESTAMP() - lastLockTime;
if (lockedDuration > maxLockedDuration) {
maxLockedDuration = lockedDuration;
}
// if (t > 2800) {
// // un-comment this if you want a nice stop for a breakpoint

View File

@ -35,8 +35,7 @@ extern schfunc_t globalTimerCallback;
*/
static efitime_t nextEventTimeNt = 0;
uint32_t beforeHwSetTimer;
uint32_t hwSetTimerTime;
uint32_t hwSetTimerDuration;
uint32_t lastExecutionCount;
static void executorCallback(void *arg) {
@ -136,9 +135,9 @@ void Executor::scheduleTimerCallback() {
if (nextEventTimeNt == EMPTY_QUEUE)
return; // no pending events in the queue
int32_t hwAlarmTime = NT2US((int32_t)nextEventTimeNt - (int32_t)nowNt);
beforeHwSetTimer = GET_TIMESTAMP();
uint32_t beforeHwSetTimer = GET_TIMESTAMP();
setHardwareUsTimer(hwAlarmTime == 0 ? 1 : hwAlarmTime);
hwSetTimerTime = GET_TIMESTAMP() - beforeHwSetTimer;
hwSetTimerDuration = GET_TIMESTAMP() - beforeHwSetTimer;
}
/**

View File

@ -106,8 +106,11 @@ efitime_t EventQueue::getNextEventTime(efitime_t nowX) {
}
static scheduling_s * longScheduling;
uint32_t maxEventQueueTime = 0;
uint32_t lastEventQueueTime;
/**
* See also maxPrecisionCallbackDuration for total hw callback time
*/
uint32_t maxEventCallbackDuration = 0;
static uint32_t lastEventCallbackDuration;
/**
* Invoke all pending actions prior to specified timestamp
@ -169,12 +172,12 @@ int EventQueue::executeAll(efitime_t now) {
#endif
current->callback(current->param);
// even with overflow it's safe to subtract here
lastEventQueueTime = GET_TIMESTAMP() - before;
if (lastEventQueueTime > maxEventQueueTime)
maxEventQueueTime = lastEventQueueTime;
if (lastEventQueueTime > 2000) {
lastEventCallbackDuration = GET_TIMESTAMP() - before;
if (lastEventCallbackDuration > maxEventCallbackDuration)
maxEventCallbackDuration = lastEventCallbackDuration;
if (lastEventCallbackDuration > 2000) {
longScheduling = current;
lastEventQueueTime++;
// what is this line about? lastEventCallbackDuration++;
}
}
return executionCounter;

View File

@ -386,11 +386,15 @@ void printAllTriggers() {
extern PwmConfig triggerSignal;
#endif /* #if EFI_PROD_CODE */
extern uint32_t maxLockTime;
extern uint32_t maxEventQueueTime;
extern uint32_t hipLastExecutionCount;
extern uint32_t hwSetTimerTime;
extern uint32_t maxPrecisionTCallbackDuration;
extern uint32_t hwSetTimerDuration;
extern uint32_t maxLockedDuration;
extern uint32_t maxEventCallbackDuration;
#if (EFI_PROD_CODE) || defined(__DOXYGEN__)
extern uint32_t maxPrecisionCallbackDuration;
#endif /* EFI_PROD_CODE */
extern int maxHowFarOff;
extern uint32_t *cyccnt;
@ -400,9 +404,13 @@ extern int vvtEventFallCounter;
void resetMaxValues() {
#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__)
maxEventQueueTime = triggerMaxDuration = 0;
maxPrecisionTCallbackDuration = 0;
maxEventCallbackDuration = triggerMaxDuration = 0;
#endif /* EFI_PROD_CODE || EFI_SIMULATOR */
maxLockedDuration = 0;
#if (EFI_PROD_CODE) || defined(__DOXYGEN__)
maxPrecisionCallbackDuration = 0;
#endif /* EFI_PROD_CODE */
}
void triggerInfo(void) {
@ -495,15 +503,14 @@ void triggerInfo(void) {
engine->m.rpmCbTime,
engine->m.mainTriggerCallbackTime);
scheduleMsg(logger, "maxLockTime=%d / maxTriggerReentraint=%d", maxLockTime, maxTriggerReentraint);
maxLockTime = 0;
scheduleMsg(logger, "maxEventQueueTime=%d", maxEventQueueTime);
scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint);
scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration);
scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount);
scheduleMsg(logger, "hwSetTimerTime %d", hwSetTimerTime);
scheduleMsg(logger, "hwSetTimerDuration=%d", hwSetTimerDuration);
scheduleMsg(logger, "totalTriggerHandlerMaxTime=%d", triggerMaxDuration);
scheduleMsg(logger, "maxPrecisionTCallbackDuration=%d", maxPrecisionTCallbackDuration);
scheduleMsg(logger, "maxPrecisionCallbackDuration=%d", maxPrecisionCallbackDuration);
resetMaxValues();
#endif /* EFI_PROD_CODE */

View File

@ -21,8 +21,13 @@
#if (EFI_PROD_CODE && HAL_USE_GPT) || defined(__DOXYGEN__)
#include "efilib2.h"
uint32_t maxPrecisionTCallbackDuration = 0;
/**
* Maximum duration of complete timer callback, all pending events together
* See also 'maxEventCallbackDuration' for maximum duration of one event
*/
uint32_t maxPrecisionCallbackDuration = 0;
// must be one of 32 bit times
#define GPTDEVICE GPTD5
static volatile efitick_t lastSetTimerTimeNt;
@ -99,8 +104,8 @@ static void callback(GPTDriver *gptp) {
uint32_t before = GET_TIMESTAMP();
globalTimerCallback(NULL);
uint32_t precisionCallbackDuration = GET_TIMESTAMP() - before;
if (precisionCallbackDuration > maxPrecisionTCallbackDuration) {
maxPrecisionTCallbackDuration = precisionCallbackDuration;
if (precisionCallbackDuration > maxPrecisionCallbackDuration) {
maxPrecisionCallbackDuration = precisionCallbackDuration;
}
}