From 95e8f4227bc57200bdc915aeb8db1eb79e3ffdcb Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 19 Nov 2019 20:36:47 -0500 Subject: [PATCH] making F4 and else happier with perf_trace, also maybe missing 'break'? --- firmware/console/binary/tunerstudio.cpp | 5 +++++ firmware/controllers/engine_controller.cpp | 2 +- firmware/development/perf_trace.cpp | 3 +++ firmware/development/perf_trace.h | 4 ++++ simulator/simulator/efifeatures.h | 2 ++ unit_tests/efifeatures.h | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index e5216babf9..be7ff45cb5 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -853,14 +853,19 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin break; case TS_PERF_TRACE_BEGIN: +#if ENABLE_PERF_TRACE perfTraceEnable(); +#endif /* ENABLE_PERF_TRACE */ break; case TS_PERF_TRACE_GET_BUFFER: { +#if ENABLE_PERF_TRACE auto trace = perfTraceGetBuffer(); sr5SendResponse(tsChannel, TS_CRC, trace.Buffer, trace.Size); +#endif /* ENABLE_PERF_TRACE */ } #endif /* EFI_TOOTH_LOGGER */ + break; default: tunerStudioError("ERROR: ignoring unexpected command"); return false; diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 5565eb4264..778fb15646 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -797,7 +797,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) // help to notice when RAM usage goes up - if a code change adds to RAM usage these variables would fail // linking process which is the way to raise the alarm #ifndef RAM_UNUSED_SIZE -#define RAM_UNUSED_SIZE 19000 +#define RAM_UNUSED_SIZE 3000 #endif #ifndef CCM_UNUSED_SIZE #define CCM_UNUSED_SIZE 4600 diff --git a/firmware/development/perf_trace.cpp b/firmware/development/perf_trace.cpp index 71abb7af28..3e1f328cda 100644 --- a/firmware/development/perf_trace.cpp +++ b/firmware/development/perf_trace.cpp @@ -4,7 +4,10 @@ #include "efitime.h" #include "os_util.h" + +#ifndef TRACE_BUFFER_LENGTH #define TRACE_BUFFER_LENGTH 2048 +#endif /* TRACE_BUFFER_LENGTH */ enum class EPhase : char { diff --git a/firmware/development/perf_trace.h b/firmware/development/perf_trace.h index f0f545e0df..9572fe2188 100644 --- a/firmware/development/perf_trace.h +++ b/firmware/development/perf_trace.h @@ -85,12 +85,16 @@ public: ScopePerf(PE event, uint8_t data) : m_event(event), m_data(data) { +#if ENABLE_PERF_TRACE perfEventBegin(event, data); +#endif /* ENABLE_PERF_TRACE */ } ~ScopePerf() { +#if ENABLE_PERF_TRACE perfEventEnd(m_event, m_data); +#endif /* ENABLE_PERF_TRACE */ } private: diff --git a/simulator/simulator/efifeatures.h b/simulator/simulator/efifeatures.h index ea11381d45..7738db68be 100644 --- a/simulator/simulator/efifeatures.h +++ b/simulator/simulator/efifeatures.h @@ -14,6 +14,8 @@ #define EFI_ENABLE_MOCK_ADC TRUE +#define ENABLE_PERF_TRACE FALSE + #define EFI_PRINTF_FUEL_DETAILS TRUE #define EFI_ENABLE_CRITICAL_ENGINE_STOP TRUE #define EFI_ENABLE_ENGINE_WARNING TRUE diff --git a/unit_tests/efifeatures.h b/unit_tests/efifeatures.h index ef90167e67..454b94eb44 100644 --- a/unit_tests/efifeatures.h +++ b/unit_tests/efifeatures.h @@ -14,6 +14,8 @@ #define EFI_CJ125 TRUE +#define ENABLE_PERF_TRACE FALSE + #define EFI_IDLE_CONTROL TRUE #define EFI_ELECTRONIC_THROTTLE_BODY TRUE