Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
Logging

Classes

struct  gts::analysis::ConcurrentLoggerEvent
 The log event payload for ConcurrentLogger. More...
 
class  gts::analysis::ConcurrentLogger
 A serialized log of per-thread messages. More...
 

Functions

 gts::analysis::ConcurrentLogger::Lock< TMutex >::Lock (TMutex &m)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::FairSpinMutex::lock ()
 
GTS_INLINE void gts::analysis::ConcurrentLogger::FairSpinMutex::unlock ()
 
GTS_INLINE void gts::analysis::ConcurrentLogger::nameThread (CaptureMask::Type captureMask, const char *fmt,...)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::logf (CaptureMask::Type captureMask, const char *fmt,...)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::logp (CaptureMask::Type captureMask, const char *txt)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::logp (CaptureMask::Type captureMask, const char *txt, uintptr_t param1)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::logp (CaptureMask::Type captureMask, const char *txt, uintptr_t param1, uintptr_t param2)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::logp (CaptureMask::Type captureMask, const char *txt, uintptr_t param1, uintptr_t param2, uintptr_t param3)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::setCaptureMask (uint64_t captureMask)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::reset (CaptureMask::Type captureMask)
 
GTS_INLINE void gts::analysis::ConcurrentLogger::lock ()
 
GTS_INLINE void gts::analysis::ConcurrentLogger::unlock ()
 
GTS_INLINE ConcurrentLoggerEventgts::analysis::ConcurrentLogger::getEvents (size_t *outEventCount)
 
GTS_INLINE std::map< std::thread::id, std::string > const & gts::analysis::ConcurrentLogger::getThreadNamesMap () const
 
void gts::analysis::printLogToTextFile (char const *filename, std::map< std::thread::id, std::string > const &threadNamesMap, ConcurrentLoggerEvent const *pEvents, size_t const eventCount)
 
void gts::analysis::printLogToCsvFile (char const *filename, std::map< std::thread::id, std::string > const &threadNamesMap, ConcurrentLoggerEvent const *pEvents, size_t const eventCount)
 

Variables

static constexpr size_t gts::analysis::ConcurrentLoggerEvent::MSG_BUFF_SIZE
 
std::thread::id gts::analysis::ConcurrentLoggerEvent::tid
 Thread ID.
 
char   gts::analysis::ConcurrentLoggerEvent::buff [MSG_BUFF_SIZE] = {0}
 Buffer for sprintf message.
 
const char *   gts::analysis::ConcurrentLoggerEvent::::msg
 
uintptr_t   gts::analysis::ConcurrentLoggerEvent::::params [4]
 
uint8_t   gts::analysis::ConcurrentLoggerEvent::::numParams
 
struct {
   const char *   msg
 
   uintptr_t   params [4]
 
   uint8_t   numParams
 
}   gts::analysis::ConcurrentLoggerEvent::msgAndParams
 Message and params.
 
union {
   char   gts::analysis::ConcurrentLoggerEvent::buff [MSG_BUFF_SIZE] = {0}
 Buffer for sprintf message.
 
   struct {
      const char *   msg
 
      uintptr_t   params [4]
 
      uint8_t   numParams
 
   }   gts::analysis::ConcurrentLoggerEvent::msgAndParams
 Message and params.
 
gts::analysis::ConcurrentLoggerEvent::message
 Message data.
 
bool gts::analysis::ConcurrentLoggerEvent::isMessageBuffer = false
 Flag 'message' as being stored in 'buff'.
 

Detailed Description

Function Documentation

◆ getEvents()

GTS_INLINE ConcurrentLoggerEvent* gts::analysis::ConcurrentLogger::getEvents ( size_t *  outEventCount)
inline

Get all the events from the logger.

Parameters
outEventCountOutputs number of events being returns.
Returns
An array of ConcurrentLoggerEvent.

◆ getThreadNamesMap()

GTS_INLINE std::map<std::thread::id, std::string> const& gts::analysis::ConcurrentLogger::getThreadNamesMap ( ) const
inline
Returns
The thread names mapped by TID.

◆ logf()

GTS_INLINE void gts::analysis::ConcurrentLogger::logf ( CaptureMask::Type  captureMask,
const char *  fmt,
  ... 
)
inline

Adds an entry to the log.

◆ logp() [1/4]

GTS_INLINE void gts::analysis::ConcurrentLogger::logp ( CaptureMask::Type  captureMask,
const char *  txt 
)
inline

Adds an entry to the log.

◆ logp() [2/4]

GTS_INLINE void gts::analysis::ConcurrentLogger::logp ( CaptureMask::Type  captureMask,
const char *  txt,
uintptr_t  param1 
)
inline

Adds an entry to the log.

◆ logp() [3/4]

GTS_INLINE void gts::analysis::ConcurrentLogger::logp ( CaptureMask::Type  captureMask,
const char *  txt,
uintptr_t  param1,
uintptr_t  param2 
)
inline

Adds an entry to the log.

◆ logp() [4/4]

GTS_INLINE void gts::analysis::ConcurrentLogger::logp ( CaptureMask::Type  captureMask,
const char *  txt,
uintptr_t  param1,
uintptr_t  param2,
uintptr_t  param3 
)
inline

Adds an entry to the log.

◆ nameThread()

GTS_INLINE void gts::analysis::ConcurrentLogger::nameThread ( CaptureMask::Type  captureMask,
const char *  fmt,
  ... 
)
inline

Names a thread.

◆ printLogToCsvFile()

void gts::analysis::printLogToCsvFile ( char const *  filename,
std::map< std::thread::id, std::string > const &  threadNamesMap,
ConcurrentLoggerEvent const *  pEvents,
size_t const  eventCount 
)

Print all the events to a CSV file.

Parameters
filenameThe location and name of the file.
threadNamesMapThread names mapped by TID.
pEventsAn array of ConcurrentLoggerEvents to print.
eventCountThe number of events in pEvents.

◆ printLogToTextFile()

void gts::analysis::printLogToTextFile ( char const *  filename,
std::map< std::thread::id, std::string > const &  threadNamesMap,
ConcurrentLoggerEvent const *  pEvents,
size_t const  eventCount 
)

Print all the events to a text file.

Parameters
filenameThe location and name of the file.
threadNamesMapThread names mapped by TID.
pEventsAn array of ConcurrentLoggerEvents to print.
eventCountThe number of events in pEvents.

◆ reset()

GTS_INLINE void gts::analysis::ConcurrentLogger::reset ( CaptureMask::Type  captureMask)
inline

Resets the log to empty.

◆ setCaptureMask()

GTS_INLINE void gts::analysis::ConcurrentLogger::setCaptureMask ( uint64_t  captureMask)
inline

Resets the log to empty.

Remarks
Not thread-safe.

Variable Documentation

◆ MSG_BUFF_SIZE

constexpr size_t gts::analysis::ConcurrentLoggerEvent::MSG_BUFF_SIZE
staticconstexpr
Initial value:
= GTS_NO_SHARING_CACHE_LINE_SIZE
- sizeof(std::thread::id)
- sizeof(bool)