52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/Tracing/TimestampedTraceEvent.h
|
|
*
|
|
* @brief Header for the TimestampedTraceEvent struct.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_TRACING_TIMESTAMPED_TRACE_EVENT_H)
|
|
#define ACTIV_BASE_TRACING_TIMESTAMPED_TRACE_EVENT_H
|
|
|
|
#include "ActivMiddleware/ActivBase/External.h"
|
|
|
|
#include "ActivMiddleware/ActivBase/IntervalTimer.h"
|
|
#include "ActivMiddleware/ActivBase/Tracing/TraceEvent.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
/**
|
|
* @brief Base TimestampedTraceEvent class.
|
|
*
|
|
* Inherit from this class to provide concrete timestamped trace points.
|
|
*
|
|
* See TraceEvent for information about defining custom events.
|
|
*/
|
|
struct TimestampedTraceEvent : TraceEvent
|
|
{
|
|
//! Generate a timestamp, called from TraceBufferBase implementation.
|
|
void GenerateTimestamp()
|
|
{
|
|
m_timestamp = IntervalTimer::GetNanosecondTimeStamp();
|
|
}
|
|
|
|
//! Get the timestamp, called from TraceBufferBase implementation.
|
|
uint64_t GetTimestamp() const
|
|
{
|
|
return m_timestamp;
|
|
}
|
|
|
|
//! Set the timestamp, called from TraceBufferBase implementation.
|
|
void SetTimestamp(const uint64_t timestamp)
|
|
{
|
|
m_timestamp = timestamp;
|
|
}
|
|
|
|
uint64_t m_timestamp; ///< The timestamp for the event.
|
|
};
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_TRACING_TIMESTAMPED_TRACE_EVENT_H)
|