From 537a95a9b4f57d8a58f41990e6489719bd7bacdd Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 23 Dec 2019 21:56:16 -0500 Subject: [PATCH] removing legacy perf code --- .../engine_cycle/main_trigger_callback.cpp | 35 ++----------------- .../engine_cycle/main_trigger_callback.h | 2 -- .../controllers/trigger/trigger_central.cpp | 25 ------------- .../controllers/trigger/trigger_central.h | 7 ++-- 4 files changed, 4 insertions(+), 65 deletions(-) diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 3fb825c1c2..6cc86b1ba0 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -40,15 +40,13 @@ #include "advance_map.h" #include "allsensors.h" #include "cyclic_buffer.h" -#include "histogram.h" #include "fuel_math.h" -#include "histogram.h" #include "cdm_ion_sense.h" #include "engine_controller.h" #include "efi_gpio.h" #if EFI_PROD_CODE #include "os_util.h" -#endif /* EFI_HISTOGRAMS */ +#endif /* EFI_PROD_CODE */ #include "local_version_holder.h" #include "event_queue.h" #include "engine.h" @@ -406,16 +404,6 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn } } -#if EFI_HISTOGRAMS -static histogram_s mainLoopHistogram; -#endif /* EFI_HISTOGRAMS */ - -void showMainHistogram(void) { -#if EFI_HISTOGRAMS - printHistogram(logger, &mainLoopHistogram); -#endif /* EFI_HISTOGRAMS */ -} - #if EFI_PROD_CODE /** * this field is used as an Expression in IAR debugger @@ -484,10 +472,6 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D warning(CUSTOM_SKIPPING_STROKE, "skipping stroke due to rpm=%d", rpm); } -#if EFI_HISTOGRAMS && EFI_PROD_CODE - int beforeCallback = hal_lld_get_counter_value(); -#endif - if (trgEventIndex == 0) { if (HAVE_CAM_INPUT()) { engine->triggerCentral.validateCamVvtCounters(); @@ -527,11 +511,6 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D * For spark we schedule both start of coil charge and actual spark based on trigger angle */ onTriggerEventSparkLogic(limitedSpark, trgEventIndex, rpm PASS_ENGINE_PARAMETER_SUFFIX); -#if EFI_HISTOGRAMS - int diff = hal_lld_get_counter_value() - beforeCallback; - if (diff > 0) - hsAdd(&mainLoopHistogram, diff); -#endif /* EFI_HISTOGRAMS */ if (trgEventIndex == 0) { ENGINE(m.mainTriggerCallbackTime) = getTimeNowLowerNt() - ENGINE(m.beforeMainTrigger); @@ -609,18 +588,13 @@ void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #include "engine_sniffer.h" #endif -static void showTriggerHistogram(void) { - printAllCallbacksHistogram(); - showMainHistogram(); -} - static void showMainInfo(Engine *engine) { #if EFI_PROD_CODE int rpm = GET_RPM(); float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE); scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el); scheduleMsg(logger, "fuel %.2fms timing %.2f", getInjectionDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX), engine->engineState.timingAdvance); -#endif +#endif /* EFI_PROD_CODE */ } void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { @@ -631,7 +605,6 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX initAuxValves(logger PASS_ENGINE_PARAMETER_SUFFIX); #if EFI_PROD_CODE - addConsoleAction("performanceinfo", showTriggerHistogram); addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine); printMsg(logger, "initMainLoop: %d", currentTimeMillis()); @@ -639,10 +612,6 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled"); #endif -#if EFI_HISTOGRAMS - initHistogram(&mainLoopHistogram, "main callback"); -#endif /* EFI_HISTOGRAMS */ - addTriggerEventListener(mainTriggerCallback, "main loop", engine); // We start prime injection pulse at the early init stage - don't wait for the engine to start spinning! diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.h b/firmware/controllers/engine_cycle/main_trigger_callback.h index 5cd1310908..e17d7621a5 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.h +++ b/firmware/controllers/engine_cycle/main_trigger_callback.h @@ -19,8 +19,6 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL int isIgnitionTimingError(void); void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE); -void showMainHistogram(void); - void startSimultaniousInjection(Engine *engine); void endSimultaniousInjection(InjectionEvent *event); void seTurnPinHigh(InjectionEvent *event); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index f4ad01a2ea..3d7c82583f 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -15,7 +15,6 @@ #include "engine_configuration.h" #include "listener_array.h" #include "data_buffer.h" -#include "histogram.h" #include "pwm_generator_logic.h" #include "tooth_logger.h" @@ -68,10 +67,6 @@ int TriggerCentral::getHwEventCounter(int index) const { EXTERN_ENGINE; -#if EFI_HISTOGRAMS -static histogram_s triggerCallbackHistogram; -#endif /* EFI_HISTOGRAMS */ - static Logging *logger; void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) { @@ -345,9 +340,6 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR engine->onTriggerSignalEvent(nowNt); -#if EFI_HISTOGRAMS && EFI_PROD_CODE - int beforeCallback = hal_lld_get_counter_value(); -#endif int eventIndex = (int) signal; efiAssertVoid(CUSTOM_ERR_6638, eventIndex >= 0 && eventIndex < HW_EVENT_TYPES, "signal type"); hwEventCounters[eventIndex]++; @@ -409,20 +401,6 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR } } -#if EFI_HISTOGRAMS - int afterCallback = hal_lld_get_counter_value(); - int diff = afterCallback - beforeCallback; - // this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity - if (diff > 0) { - hsAdd(&triggerCallbackHistogram, diff); - } -#endif /* EFI_HISTOGRAMS */ -} - -void printAllCallbacksHistogram(void) { -#if EFI_HISTOGRAMS - printHistogram(logger, &triggerCallbackHistogram); -#endif } EXTERN_ENGINE @@ -738,9 +716,6 @@ void initTriggerCentral(Logging *sharedLogger) { addConsoleAction("reset_trigger", resetRunningTriggerCounters); #endif -#if EFI_HISTOGRAMS - initHistogram(&triggerCallbackHistogram, "all callbacks"); -#endif /* EFI_HISTOGRAMS */ } #endif diff --git a/firmware/controllers/trigger/trigger_central.h b/firmware/controllers/trigger/trigger_central.h index c441e090f5..0a81c26416 100644 --- a/firmware/controllers/trigger/trigger_central.h +++ b/firmware/controllers/trigger/trigger_central.h @@ -2,11 +2,10 @@ * @file trigger_central.h * * @date Feb 23, 2014 - * @author Andrey Belomutskiy, (c) 2012-2017 + * @author Andrey Belomutskiy, (c) 2012-2019 */ -#ifndef TRIGGER_CENTRAL_H_ -#define TRIGGER_CENTRAL_H_ +#pragma once #include "rusefi_enums.h" #include "listener_array.h" @@ -61,7 +60,6 @@ void hwHandleShaftSignal(trigger_event_e signal); void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX); void initTriggerCentral(Logging *sharedLogger); -void printAllCallbacksHistogram(void); void printAllTriggers(); void addTriggerEventListener(ShaftPositionListener handler, const char *name, Engine *engine); @@ -72,4 +70,3 @@ void onConfigurationChangeTriggerCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE); bool checkIfTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE); bool isTriggerConfigChanged(DECLARE_ENGINE_PARAMETER_SIGNATURE); -#endif /* TRIGGER_CENTRAL_H_ */