rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
perf_trace.h
Go to the documentation of this file.
1/**
2 * @file perf_trace.h
3 *
4 * https://github.com/rusefi/rusefi/wiki/Developer-Performance-Tracing
5 *
6 */
7#pragma once
8
9#include "big_buffer.h"
10
11#include <cstdint>
12#include <cstddef>
13
14// Defines different events we want to trace. These can be an interval (begin -> end), or an
15// instant. Instants can be global, or specific to one thread. You probably don't want to use
16// each element in PE more than once, as they should each indicate that a specific thing began,
17// ended, or occurred.
18enum class PE : uint8_t {
19 // The tag below is consumed by PerfTraceTool.java which generates EnumNames.java
20 // enum_start_tag
21 INVALID,
22 ISR,
35 PeriodicTimerControllerPeriodicTask, //TODO: main_loop remove this after migrating to main_loop
58 Unused,
92 // enum_end_tag
93 // The tag above is consumed by PerfTraceTool.java
94 // please note that the tool requires a comma at the end of last value
95};
96
97void perfEventBegin(PE event);
98void perfEventEnd(PE event);
99void perfEventInstantGlobal(PE event);
100
101// Enable one buffer's worth of perf tracing, and retrieve the buffer size in bytes
102void perfTraceEnable();
103
104// Retrieve the trace buffer
106
107#if ENABLE_PERF_TRACE
109{
110public:
111 ScopePerf(PE event) : m_event(event) {
112 perfEventBegin(event);
113 }
114
116 {
118 }
119
120private:
121 const PE m_event;
122};
123
124#else /* if ENABLE_PERF_TRACE */
125
126struct ScopePerf {
128};
129
130#endif /* ENABLE_PERF_TRACE */
const PE m_event
Definition perf_trace.h:121
ScopePerf(PE event)
Definition perf_trace.h:111
ScopePerf(PE)
Definition perf_trace.h:127
void perfEventInstantGlobal(PE event)
const BigBufferHandle perfTraceGetBuffer()
void perfEventBegin(PE event)
void perfTraceEnable()
PE
Definition perf_trace.h:18
@ GetInjectionDuration
@ CanThreadRx
@ OnTriggerEventSparkLogic
@ Temporary16
@ Temporary4
@ HandleShaftSignal
@ Temporary11
@ ContextSwitch
@ Temporary15
@ Temporary10
@ EnginePeriodicSlowCallback
@ Temporary2
@ LuaOneCanTxFunction
@ PwmGeneratorCallback
@ EventQueueExecuteAll
@ PrepareIgnitionSchedule
@ GetBaseFuel
@ ShaftPositionListeners
@ Temporary9
@ AdcConversionFast
@ Temporary6
@ SingleTimerExecutorDoExecute
@ OutputPinSetValue
@ SingleTimerExecutorScheduleByTimestamp
@ KnockAnalyzer
@ SingleTimerExecutorScheduleTimerCallback
@ EventQueueInsertTask
@ PwmConfigStateChangeCallback
@ LuaOneCanRxCallback
@ GetTimeNowUs
@ MapAveragingTriggerCallback
@ TunerStudioHandleCrcCommand
@ LuaTickFunction
@ MainTriggerCallback
@ Temporary12
@ LuaAllCanRxFunction
@ Temporary13
@ LogTriggerTooth
@ EngineSniffer
@ DecodeTriggerEvent
@ Temporary1
@ EnginePeriodicFastCallback
@ Unused
@ Temporary14
@ Temporary8
@ LuaOneCanRxFunction
@ Temporary3
@ AdcConversionSlow
@ CanThreadTx
@ SoftwareKnockProcess
@ EngineStatePeriodicFastCallback
@ GetSpeedDensityFuel
@ AdcProcessSlow
@ AdcSubscriptionUpdateSubscribers
@ WallFuelAdjust
@ HandleFuel
@ Hip9011IntHoldCallback
@ MainLoop
@ EventQueueExecuteCallback
@ GetRunningFuel
@ PeriodicControllerPeriodicTask
@ ISR
@ INVALID
@ GetTpsEnrichment
@ Temporary7
@ GlobalUnlock
@ GlobalLock
@ PeriodicTimerControllerPeriodicTask
@ Temporary5
@ CanDriverTx
@ AdcCallbackFast
void perfEventEnd(PE event)