Harlequin RIP SDK
probelog.h File Reference

Capture profiling information from RIP. More...

#include "skinkit.h"

Data Structures

struct  tracelog_header_t
 
struct  tracelog_entry_t
 

Macros

#define ALIGN_UP_8(s_)   (((s_) + 7) & ~7)
 

Typedefs

typedef struct tracelog_header_t tracelog_header_t
 
typedef struct tracelog_entry_t tracelog_entry_t
 

Functions

size_t save_trace_names (void *dest, const char **names, int nnames)
 

Variables

const char ** g_ppTraceNames
 
int g_nTraceNames
 
int * g_pabTraceEnabled
 
const char ** g_ppTraceTypeNames
 
int g_nTraceTypeNames
 
char g_szProbeLog [260]
 Probe log filename.
 

Detailed Description

Capture profiling information from RIP.

See also
Lightweight tracing API.

Macro Definition Documentation

◆ ALIGN_UP_8

#define ALIGN_UP_8 (   s_)    (((s_) + 7) & ~7)

Round a size up to an 8 byte multiple.

Typedef Documentation

◆ tracelog_entry_t

A single entry in the memory resident log. Explicitly sizes, because this is the same for all architectures. A trace entry contains:

  • A 64-bit timestamp, in tickspersec units;
  • A 64-bit duration, in tickspersec units;
  • A 64-bit thread ID (64-bits because this is a pointer on Unix/MacOS);
  • A 32-bit trace ID corresponding to a valid name in the trace name table;
  • A 32-bit trace type corresponding to a valid name in the trace type table;
  • A 64-bit trace designator, used for each different trace type to denote an object, count, amount, or value of interest.

Trace entries are individually aligned to 8 bytes.

◆ tracelog_header_t

The header for the memory mapped log. Explicit sizes, because this is the save for all architectures. The memory mapped log contains:

  • An 8-byte magic number containing the characters 'HQNplog' followed by LF. This is used to determine that a logfile is in binary format.
  • An 8-byte byte order marker. This is initialised to the 64-bit integer 0x0807060504030201. The order of bytes in a saved logfile can be used to check whether the logfile was produced on a different architecture, and swap byte order if necessary.
  • A 64-bit size of this header structure in bytes;
  • A 64-bit timebase, indicating the number of ticks per second in time fields;
  • A 64-bit start time, giving an offset from a known reference such that multiple RIPs or trace logs within the same boot cycle can be compared.
  • A 64-bit offset field indicating the number of bytes from the start of the header (also the start of the file) to the trace name table. All table offsets are 64-bit aligned;
  • A 64-bit offset field indicating the number of bytes from the start of the header (also the start of the file) to the trace type name table;
  • A 64-bit offset field indicating the number of bytes from the start of the header (also the start of the file) to the trace entry table;
  • A 64-bit size of each trace entry.
  • A 64-bit count of the number of entries in the trace entry table.

Function Documentation

◆ save_trace_names()

size_t save_trace_names ( void *  dest,
const char **  names,
int  nnames 
)

Save a name mapping table to a memory location, and/or compute the size of the storage for the mapping table.

Parameters
destWhere to save the name mapping table. If this is NULL, the table will not be saved, but the size required to store the table will be returned.
namesThe names in the name mapping table.
nnamesThe number of names in the name mapping table.
Returns
The size of the table, in bytes, rounded up to 8 bytes.

Variable Documentation

◆ g_nTraceNames

int g_nTraceNames
extern

Number of trace names in trace name array

◆ g_nTraceTypeNames

int g_nTraceTypeNames
extern

Number of trace type names in trace type list

◆ g_pabTraceEnabled

int* g_pabTraceEnabled
extern

This pointer will point to either the default enabled/disable state array, or an array that was specified in the init function.

◆ g_ppTraceNames

const char** g_ppTraceNames
extern

This pointer will point to either the default trace name array, or an array that was specified in the init function.

◆ g_ppTraceTypeNames

const char** g_ppTraceTypeNames
extern

This pointer will point to either the default trace type name array, or an array that was specified in the init function.