6#define __RTTracer_h__ included
10#include <RTJsonResult.h>
11#include <RTStreamBuffer.h>
45 static bool configure(
const char* configFile =
nullptr);
55 static RTS_INLINE
void note(
const std::string& text);
74 typedef std::chrono::system_clock::time_point
TraceTime;
101 TIME_ABSOLUTE = 0x80,
102 PRECISION_MASK = 0x0F,
103 PRECISION_NANO = 0x09,
104 PRECISION_MICRO = 0x06,
105 PRECISION_MILLI = 0x03
109 static std::string _applicationName;
110 static std::string _traceFileName;
111#if RTTRACER_FLUSH_COUNT
112 static int _messagesSinceFlush;
114 static bool _enabled;
115 static bool _configured;
116 static bool _overwriteFile;
120 static int _timestamps;
121 void printTimestamp(
const TraceTime& timestamp);
124 std::string _traceFile;
130 static std::string initTraceFile(
void);
132 static void getSenderInfo(
const RTMessage*, TraceInfo*);
137 void traceNote(
const std::string& text);
138 void traceNote_nolock(
const std::string& text);
146#define TRACE_TIME1 "time1_send"
147#define TRACE_TIME2 "time2_receive"
148#define TRACE_TIME3 "time3_handle"
151#include <RTTracer.inl>
An instance of this class represents a capsule instance.
Definition: RTActor.h:44
Represents the result of parsing a JSON string.
Definition: RTJsonResult.h:30
Represents a message used for communication between capsule instances.
Definition: RTMessage.h:33
Represents a general capsule port typed by a protocol which determines the set of events that can be ...
Definition: RTProtocol.h:50
Definition: RTStreamBuffer.h:22
Definition: RTTracer.h:20
std::chrono::system_clock::time_point TraceTime
Type for storing trace timestamps.
Definition: RTTracer.h:74
static RTTracer & instance()
Get the singleton instance of RTTracer.
static bool isConfigured(void)
Check if tracing has been configured.
Definition: RTTracer.inl:20
static bool configure(const char *configFile=nullptr)
Configure RTTracer and tracing preferences.
static void flushTrace(void)
Flush buffered trace messages to file.
Definition: RTTracer.inl:12
static bool isEnabled(void)
Check if tracing is enabled.
Definition: RTTracer.inl:16
static void note(const std::string &text)
Write a note to the trace.
Definition: RTTracer.inl:31
TraceEventKind
Types of trace events supported.
Definition: RTTracer.h:60
static void setEnabled(bool)
Enable or disable tracing to file.
int flush(void) override
Flushes the data written to the buffer.
Structure with additional info passed to traceMessage call.
Definition: RTTracer.h:80