C++ TargetRTS
Loading...
Searching...
No Matches
Classes | Public Types | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
RTTracer Class Reference
Inheritance diagram for RTTracer:
RTStreamBuffer RTOBuffer

Classes

struct  TraceInfo
 Structure with additional info passed to traceMessage call. More...
 

Public Types

enum  TraceEventKind {
  Initialize , Send , Invoke , InvokeWithoutReply ,
  Reply , Pause , Flush
}
 Types of trace events supported.
 
typedef std::chrono::system_clock::time_point TraceTime
 Type for storing trace timestamps.
 

Static Public Member Functions

static void flushTrace (void)
 Flush buffered trace messages to file.
 
static bool isEnabled (void)
 Check if tracing is enabled.
 
static void setEnabled (bool)
 Enable or disable tracing to file.
 
static bool configure (const char *configFile=nullptr)
 Configure RTTracer and tracing preferences.
 
static bool isConfigured (void)
 Check if tracing has been configured.
 
static void note (const char *text)
 Write a note to the trace.
 

Protected Types

enum  {
  TIME1 = 0x10 , TIME2 = 0x20 , TIME3 = 0x40 , TIME_ABSOLUTE = 0x80 ,
  PRECISION_MASK = 0x0F , PRECISION_NANO = 0x09 , PRECISION_MICRO = 0x06 , PRECISION_MILLI = 0x03
}
 

Protected Member Functions

void printTimestamp (const TraceTime &timestamp)
 
void traceMessage (const RTMessage *, TraceEventKind traceEventKind, const TraceInfo *)
 
void traceNote (const char *text)
 
void traceNote_nolock (const char *text)
 
int flush (void) override
 Flushes the data written to the buffer.
 

Static Protected Member Functions

static RTTracerinstance ()
 
static std::string initTraceFile (void)
 
static void getSenderInfo (const RTMessage *, TraceInfo *)
 
static void traceMS (const RTMessage *, TraceEventKind traceEventKind, const TraceInfo *=nullptr)
 

Protected Attributes

std::string _traceFile
 
std::ofstream _file
 
- Protected Attributes inherited from RTStreamBuffer
int offset
 
char buffer [80]
 

Static Protected Attributes

static bool _enabled
 
static RTJsonResult jsonConfig
 
static bool _configured
 
static std::string _applicationName
 
static std::string _traceFileName
 
static bool _overwriteFile
 
static TraceTime _start
 
static int _timestamps
 

Friends

class RTActor
 
class RTMessage
 
class RTProtocol
 

Additional Inherited Members

- Public Member Functions inherited from RTStreamBuffer
virtual int write (const char *data, int size) override
 Write a string to the buffer.
 
virtual int write (const char *data, int size)=0
 Write a string to the buffer.
 
virtual int flush (void)=0
 Flushes the data written to the buffer.
 

Member Function Documentation

◆ configure()

static bool RTTracer::configure ( const char *  configFile = nullptr)
static

Configure RTTracer and tracing preferences.

Parse JSON configuration file and override defaults.

Parameters
configFileJSON configuration file to parse. If not provided, get it from the -traceConfig command line argument instead.

◆ flush()

int RTTracer::flush ( void  )
overrideprotectedvirtual

Flushes the data written to the buffer.

For some output buffers, the written data will not appear in the output until flush() has been called. For others explicit flushing is not needed.

Returns
1 if successful, 0 otherwise

Implements RTOBuffer.

◆ flushTrace()

void RTTracer::flushTrace ( void  )
static

Flush buffered trace messages to file.

This function is called each time 'trace [on|off]' command is sent to the running application.

◆ isConfigured()

bool RTTracer::isConfigured ( void  )
static

Check if tracing has been configured.

Returns
true if yes, false if no.

◆ isEnabled()

bool RTTracer::isEnabled ( void  )
static

Check if tracing is enabled.

Returns
true if yes, false if no.

◆ note()

void RTTracer::note ( const char *  text)
static

Write a note to the trace.

Parameters
textNote text to write to the trace.

◆ setEnabled()

static void RTTracer::setEnabled ( bool  )
static

Enable or disable tracing to file.

This function can be called many times during execution. When tracing status changes to disabled, a note saying that tracing is paused is written to the trace and all output is flushed to file. Note that enabling or disabling tracing takes effect immediately. That is, if this function is called while processing a message (e.g. from a transition code snippet) that message will not be traced if tracing is turned off (setEnabled(false)) while it will be traced if tracing is turned on (setEnabled(true)).


The documentation for this class was generated from the following files: