/************************************************************************* Copyright (c) 2024 by CNRS/LESIA This software is copyrighted by and is the sole property of CNRS/LESIA. All rights, title, ownership, or other interests in the software remain the property of CNRS/LESIA. This software may only be used in accordance with the corresponding license agreement. Any unauthorized use, duplication, transmission, distribution, or disclosure of this software is expressly forbidden. This Copyright notice may not be removed or modified without prior written consent of CNRS/LESIA. LESIA Observatoire de Meudon 5 place Jules Janssen 92195 Meudon http://www.lesia.obspm.fr/-Logiciels-embarques-.html *************************************************************************/ /************************************************************************ GericosCore Component GscTimingExecutionTrace.hpp $Rev: 000 $ ************************************************************************/ /************************************************************************ COMPONENT DEFINITION GscTimingExecutionTrace.hpp AUTHOR LeeRoy MALAC-ALLAIN , LESIA. ************************************************************************/ #ifndef TIMING_EXECUTION_TRACE_H_ #define TIMING_EXECUTION_TRACE_H_ #include #include "icq_timing_execution_entry.h" #include "icq_timing_execution_event_enum.h" #include "icq_timestamp.h" /** * GscTimingExecutionTrace manage the buffer of timingExecutionEntriesto record execution trace events. */ typedef struct { ///< define if the trace execution mechanism is globally active or not. uint32_t entryCount ; ///< current number of entires uint32_t entryCountMax ; ///< maximum number of entries int overwrite ; ///< true = rolling mode / false = trace stopped when full icq_timing_execution_entry_t** timingExecutionEntries ; ///< pointer to the array of GscTimingExecutionEntry objects. The array itself is instantiated in a specific section (see above). }icq_timing_execution_trace_t; static int timingExecutionTraceActive = 1; /// Default constructor icq_timing_execution_trace_t* icq_timing_execution_trace_init(); /* /// Enable the execution trace mechanism for the application static void icq_timing_execution_trace_enableAllTimingExecutionTrace(){ timingExecutionTraceActive = 1; } /// Disable the execution trace mechanism for the application static void icq_timing_execution_trace_disableAllTimingExecutionTrace(){ timingExecutionTraceActive = 0; } */ /** * Get the timing execution trace of the component currently active if the trace mechanism is globally active. * @return a pointer on the timing execution trace of the component currently active or null if TimingExecutionTraceGloballyActive() is false. */ //TO BE SEEN IF ADAPTABLE //static GscTimingExecutionTrace* icq_timing_execution_trace_getCurrentTimingExecutionTrace(); /** * Initialize the timingExecutionEntries by setting its parameters and reset the content of the buffer. * @param timingExecutionEntrie pointer on the buffer where to store the timingExecutionEntries * @param size number of events which can be stored in the buffer * @param overwrite true = rolling mode / false = trace stopped when full */ void icq_timing_execution_trace_initTimingExecutionEntries(icq_timing_execution_trace_t* timing_execution_trace, icq_timing_execution_entry_t* timingExecutionEntrie, uint32_t size, int overwrite); /** * Check if the execution trace mechanism is active for the component * @return true if the execution trace mechanism is active for the component */ int icq_timing_execution_trace_isTimingExecutionTraceActive(icq_timing_execution_trace_t* timing_execution_trace); /** * Add to \a timingExecutionEntries a timing execution event, if the buffer is not full or rolling mode is enabled. * Before using this function, the attribute \a timingExecutionEntries must by checked as not null (see isTimingExecutionEntriesSet()). * This function should be called only if the execution trace mechanism is active for the component (see isTimingExecutionTraceActive()). * @param timingExecutionEvent the timing execution event to add * @param parameterId the parameter ID associated with the event * @param time the time associated with the event */ void icq_timing_execution_trace_addTimingExecutionEvent(icq_timing_execution_trace_t* timing_execution_trace, enum icq_timing_execution_event_enum timingExecutionEvent, uint8_t parameterId, uint64_t time); /** * Add a timing execution event if the execution trace mechanism is active for the component. Use the current time and a nul paramter. * @param timingExecutionEvent the timing execution event to add * @param parameterId the parameter ID associated with the event * @param time the time associated with the event */ void icq_timing_execution_trace_addTimingExecutionEventIfActiveWithParamAndTime(icq_timing_execution_trace_t* timing_execution_trace, enum icq_timing_execution_event_enum timingExecutionEvent, uint8_t parameterId, uint64_t time); /** * Add a timing execution event if the execution trace mechanism is active for the component. Use the current time. * @param timingExecutionEvent the timing execution event to add * @param parameterId the parameter ID associated with the event */ void icq_timing_execution_trace_addTimingExecutionEventIfActiveWithParam(icq_timing_execution_trace_t* timing_execution_trace, enum icq_timing_execution_event_enum timingExecutionEvent, uint8_t parameterId); /** * Add a timing execution event if the execution trace mechanism is active for the component. Use the current time and a nul paramter. * @param timingExecutionEvent the timing execution event to add */ void icq_timing_execution_trace_addTimingExecutionEventIfActive(icq_timing_execution_trace_t* timing_execution_trace, enum icq_timing_execution_event_enum timingExecutionEvent); /** * Check if the execution trace mechanism is globally active. * The attribute \a timingExecutionEntries must also by checked before adding a timing execution event * @return true if the execution trace mechanism is globally active */ //TO BE SEEN IF ADAPTABLE //static int icq_timing_execution_trace_isTimingExecutionTraceGloballyActive(); /** * Check if the attribute \a timingExecutionEntries is set * @return true if the attribute \a timingExecutionEntries is set */ int icq_timing_execution_trace_isTimingExecutionEntriesSet(icq_timing_execution_trace_t* timing_execution_trace); #endif /* TIMING_EXECUTION_TRACE_H_ */