Loading...
Searching...
No Matches
VdfExecutionStats Class Reference

Execution stats profiling event logger. More...

#include <executionStats.h>

Classes

struct  Event
 Execution Stats event. More...
 
struct  ScopedEvent
 Scoped event that automatically logs when created and destroyed. More...
 
struct  ScopedMallocEvent
 Scoped event that automatically pushes and pops malloc tags for the given VdfNode. More...
 

Public Types

enum  EventType : uint8_t {
  NodeEvaluateEvent = 0x0 , NodePrepareEvent = 0x1 , NodeRequiredInputsEvent = 0x2 , NodeInputsTaskEvent = 0x3 ,
  NodeDidComputeEvent = 0x10 , ElementsCopiedEvent = 0x11 , ElementsProcessedEvent = 0x12 , RequestedOutputInSpeculationsEvent = 0x13 ,
  MaxEvent = 0x3F
}
 The upper 2 bits are reserved as a flag for the event type: Highest bit : time event flag 2nd high bit : time end event flag. More...
 
typedef uint64_t EventData
 

Public Member Functions

VDF_API VdfExecutionStats (const VdfNetwork *network)
 Constructor for parent execution stats that have no invoking node.
 
VDF_API ~VdfExecutionStats ()
 Destructor.
 
void LogData (EventType event, const VdfNode &node, EventData data)
 Log event API.
 
void LogTimestamp (EventType event, const VdfNode &node)
 Log timestamp API.
 
void LogBeginTimestamp (EventType event, const VdfNode &node)
 Logs timestamped begin event.
 
void LogEndTimestamp (EventType event, const VdfNode &node)
 Logs timestamped end event.
 
VDF_API VdfExecutionStatsAddSubStat (const VdfNetwork *network, const VdfNode *invokingNode)
 Push execution stats onto the hierarchy queue.
 
const std::optional< VdfId > & GetInvokingNodeId () const
 Returns the invoking node, if any.
 

Static Public Member Functions

static VDF_API std::string GetMallocTagName (const VdfId *invokingNodeId, const VdfNode &node)
 Returns a unique name for the given node.
 
static EventType GetBaseEvent (EventType event)
 Returns the base event (e.g.
 
static bool IsEndEvent (EventType event)
 Returns true if the event is an end event (e.g.
 
static bool IsBeginEvent (EventType event)
 Returns true if the event is a begin event.
 

Protected Member Functions

VDF_API VdfExecutionStats (const VdfNetwork *network, VdfId nodeId)
 Sub stat constructor.
 
void _Log (EventType event, VdfId nodeId, EventData data)
 Logs data.
 
void _LogTime (EventType event, const VdfNode &node)
 Logs timestamp.
 
VDF_API VdfExecutionStats_AddSubStat (const VdfNetwork *network, VdfId invokingNodeId)
 Adds sub stat.
 
EventType _TagBegin (EventType event)
 Tags the begin flag.
 
EventType _TagEnd (EventType event)
 Tags the end flag.
 

Friends

class VdfExecutionStatsProcessor
 

Detailed Description

Execution stats profiling event logger.

Clients must use a VdfExecutionStatsProcessor to interact with the results logged in the stats object.

Definition at line 36 of file executionStats.h.

Member Typedef Documentation

◆ EventData

typedef uint64_t EventData

Definition at line 72 of file executionStats.h.

Member Enumeration Documentation

◆ EventType

enum EventType : uint8_t

The upper 2 bits are reserved as a flag for the event type: Highest bit : time event flag 2nd high bit : time end event flag.

The lower 6 bits are the base type of the event. Scoped events are automatically tagged as begin and end events.

Definition at line 55 of file executionStats.h.

Constructor & Destructor Documentation

◆ VdfExecutionStats() [1/2]

VDF_API VdfExecutionStats ( const VdfNetwork network)
explicit

Constructor for parent execution stats that have no invoking node.

◆ ~VdfExecutionStats()

VDF_API ~VdfExecutionStats ( )

Destructor.

◆ VdfExecutionStats() [2/2]

VDF_API VdfExecutionStats ( const VdfNetwork network,
VdfId  nodeId 
)
protected

Sub stat constructor.

Only called from _AddSubStat.

Member Function Documentation

◆ _AddSubStat()

VDF_API VdfExecutionStats * _AddSubStat ( const VdfNetwork network,
VdfId  invokingNodeId 
)
protected

Adds sub stat.

◆ _Log()

void _Log ( EventType  event,
VdfId  nodeId,
EventData  data 
)
inlineprotected

Logs data.

Definition at line 211 of file executionStats.h.

◆ _LogTime()

void _LogTime ( EventType  event,
const VdfNode node 
)
inlineprotected

Logs timestamp.

Definition at line 218 of file executionStats.h.

◆ _TagBegin()

EventType _TagBegin ( EventType  event)
inlineprotected

Tags the begin flag.

Definition at line 232 of file executionStats.h.

◆ _TagEnd()

EventType _TagEnd ( EventType  event)
inlineprotected

Tags the end flag.

Definition at line 238 of file executionStats.h.

◆ AddSubStat()

VDF_API VdfExecutionStats * AddSubStat ( const VdfNetwork network,
const VdfNode invokingNode 
)

Push execution stats onto the hierarchy queue.

◆ GetBaseEvent()

static EventType GetBaseEvent ( EventType  event)
inlinestatic

Returns the base event (e.g.

event type specified by the lower 6 bits).

Definition at line 186 of file executionStats.h.

◆ GetInvokingNodeId()

const std::optional< VdfId > & GetInvokingNodeId ( ) const
inline

Returns the invoking node, if any.

Definition at line 173 of file executionStats.h.

◆ GetMallocTagName()

static VDF_API std::string GetMallocTagName ( const VdfId invokingNodeId,
const VdfNode node 
)
static

Returns a unique name for the given node.

◆ IsBeginEvent()

static bool IsBeginEvent ( EventType  event)
inlinestatic

Returns true if the event is a begin event.

Definition at line 199 of file executionStats.h.

◆ IsEndEvent()

static bool IsEndEvent ( EventType  event)
inlinestatic

Returns true if the event is an end event (e.g.

if the second highest bit is set).

Definition at line 193 of file executionStats.h.

◆ LogBeginTimestamp()

void LogBeginTimestamp ( EventType  event,
const VdfNode node 
)
inline

Logs timestamped begin event.

Automatically flags the event.
NOTE : To get automatic begin and end logging on scope, use ScopedEvent.

Definition at line 153 of file executionStats.h.

◆ LogData()

void LogData ( EventType  event,
const VdfNode node,
EventData  data 
)
inline

Log event API.

Used to log a single event.

Definition at line 140 of file executionStats.h.

◆ LogEndTimestamp()

void LogEndTimestamp ( EventType  event,
const VdfNode node 
)
inline

Logs timestamped end event.

Automatically flags the event. NOTE : To get automatic begina dn end logging on scope, use ScopedEvent.

Definition at line 160 of file executionStats.h.

◆ LogTimestamp()

void LogTimestamp ( EventType  event,
const VdfNode node 
)
inline

Log timestamp API.

Used to log a single timestamp.

Definition at line 146 of file executionStats.h.

Friends And Related Function Documentation

◆ VdfExecutionStatsProcessor

friend class VdfExecutionStatsProcessor
friend

Definition at line 243 of file executionStats.h.


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