65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/Tracing/TraceEvent.h
|
|
*
|
|
* @brief Header for the TraceEvent struct.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_TRACING_TRACE_EVENT_H)
|
|
#define ACTIV_BASE_TRACING_TRACE_EVENT_H
|
|
|
|
#include "ActivMiddleware/ActivBase/External.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! Trace point id type.
|
|
typedef uint32_t TracePointId;
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* @brief Base TraceEvent class.
|
|
*
|
|
* Inherit from this class to provide concrete trace events. Derived classes must be simple aggregate types and fit within the
|
|
* trace buffer size constraints.
|
|
*
|
|
* A Decode method must be provided that returns a string to log.
|
|
*
|
|
* String Decode()
|
|
* {
|
|
* return "Example";
|
|
* }
|
|
*
|
|
* Static data can be passed when adding a trace point which is then passed to decode.
|
|
*
|
|
* String Decode(const String &staticString)
|
|
* {
|
|
* return staticString;
|
|
* }
|
|
*
|
|
* A static TracePointId constant named ID can be provided in derived classes to simplify registering and recording.
|
|
*
|
|
* static const ID = TRACE_POINT_EXAMPLE;
|
|
*/
|
|
struct TraceEvent
|
|
{
|
|
//! The base event does not support timestamps.
|
|
void GenerateTimestamp()
|
|
{
|
|
}
|
|
|
|
//! The base event does not support timestamps.
|
|
uint64_t GetTimestamp() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
TracePointId m_tracePointId; ///< The id of the trace point this event is for.
|
|
};
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_TRACING_TRACE_EVENT_H)
|