Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::NvtxProfiler Class Reference

A class to wrap calls to the NVTX library for tracking events that occur within an Hedgehog task graph. More...

#include "nvtx_profiler.h"

Collaboration diagram for hh::NvtxProfiler:
Collaboration graph

Public Member Functions

 NvtxProfiler ()=delete
 Deleted default constructor.
 
 NvtxProfiler (std::string const &taskName)
 Constructs the NvtxProfiler with the name of the task.
 
 ~NvtxProfiler ()
 Destructor, deletes all attributes allocated.
 
void initialize (int threadId)
 Initializes the NvtxProfiler, and adds the threadId that is associated with the task.
 
void addReleaseMarker ()
 Adds hedgehog release marker into the timeline to show when the task released memory.
 
void startRangeInitializing ()
 Starts tracking intialization in the timeline to show when the task has started its initialization phase.
 
void startRangeExecuting ()
 Starts tracking execution in the timeline to show when the task has started executing on data.
 
void startRangeWaiting (size_t const &queueSize)
 Starts tracking execution in the timeline to show when the task has started waiting for data.
 
void startRangeWaitingForMemory ()
 Starts tracking waiting for memory in the timeline to show when the task has started waiting for memory from hedgehog memory manager.
 
void startRangeShuttingDown ()
 Starts tracking shutdown in the timeline to show when the task has started its shutdown phase.
 
void endRangeInitializing ()
 Ends tracking the initialization phase for hedgehog task.
 
void endRangeExecuting ()
 Ends tracking the execute for hedgehog task.
 
void endRangeWaiting ()
 Ends tracking the waiting for data for hedgehog task.
 
void endRangeWaitingForMem ()
 Ends tracking the waiting for memory from hedgehog memory edge.
 
void endRangeShuttingDown ()
 Ends tracking the shutdown phase for hedgehog task.
 

Static Private Member Functions

static nvtxEventAttributes_t * createEventAttribute (uint32_t color)
 Creates an event attribute with hedgehog specified color.
 

Private Attributes

std::string initializeName_ {}
 Name for the initialization attribute.
 
std::string executeName_ {}
 Name for the execute attribute.
 
std::string waitName_ {}
 Name for the wait attribute.
 
std::string waitForMemName_ {}
 Name for the wait for memory attribute.
 
std::string releaseMemName_ {}
 Name for the release memory attribute.
 
std::string shutdownName_ {}
 Name for the shutdown attribute.
 
nvtxDomainHandle_t taskDomain_
 The domain for the task.
 
nvtxStringHandle_t initializeString_ {}
 Cache'd string used within the initialize attribute.
 
nvtxStringHandle_t executeString_ {}
 Cache'd string used within the execute attribute.
 
nvtxStringHandle_t waitString_ {}
 Cache'd string used within the wait attribute.
 
nvtxStringHandle_t waitForMemString_ {}
 Cache'd string used within the wait for memory attribute.
 
nvtxStringHandle_t releaseMemString_ {}
 Cache'd string used within the release memory attribute.
 
nvtxStringHandle_t shutdownString_ {}
 Cache'd string used within the shutdown attribute.
 
nvtxEventAttributes_t * initializeAttrib_
 The initialize attribute.
 
nvtxEventAttributes_t * executeAttrib_
 The execute attribute.
 
nvtxEventAttributes_t * waitAttrib_
 The wait attribute.
 
nvtxEventAttributes_t * waitForMemAttrib_
 The wait for memory attribute.
 
nvtxEventAttributes_t * releaseMemAttrib_
 The release memory attribute.
 
nvtxEventAttributes_t * shutdownAttrib_
 The shutdown attribute.
 
nvtxRangeId_t initializeRangeId_ = 0
 Range identifier for initialize.
 
nvtxRangeId_t executeRangeId_ = 0
 Range identifier for execute.
 
nvtxRangeId_t waitRangeId_ = 0
 Range identifier for wait (for data)
 
nvtxRangeId_t waitForMemRangeId_ = 0
 Range identifier for wait for memory.
 
nvtxRangeId_t shutdownRangeId_ = 0
 Range identifier for shutdown.
 

Detailed Description

A class to wrap calls to the NVTX library for tracking events that occur within an Hedgehog task graph.

Hedgehog uses the NVTX API and NVIDIA Nsight Systems to visualize the execution of hedgehog graph of tasks.

The current profiling mode is to have one NVTX domain per task.

In this mode, hedgehog task uses the single domain to visualize when the task is initializing, executing, waiting for memory, waiting for data, releasing memory, and shutting down. This has the effect of visualizing all tasks and their threads to identify precisely what that task is doing at any moment in time. This is useful for visualizing the interaction between tasks and identify bottlenecks.

Depending on the version of the Nsight Systems tool, there may be limitations to the number of NVTX domains. If your graph is extremely large, it is recommended to get the latest version of the NVIDIA Nsight Systems tool.

Note
To enable NVTX profiling you must add the HH_USE_NVTX directive.
Add 'FindNVTX.cmake' to your project to assist in finding the necessary includes and libraries for use with NVTX

Definition at line 58 of file nvtx_profiler.h.

Constructor & Destructor Documentation

◆ NvtxProfiler() [1/2]

hh::NvtxProfiler::NvtxProfiler ( )
delete

Deleted default constructor.

◆ NvtxProfiler() [2/2]

hh::NvtxProfiler::NvtxProfiler ( std::string const &  taskName)
inlineexplicit

Constructs the NvtxProfiler with the name of the task.

Each NvtxProfiler will hold profiling information for each task. It will profile all stages of the task's life cycle: initialize, execution, waiting for data, waiting for memory, releasing memory, and shutting down.

Parameters
taskNamethe name of the task

Definition at line 101 of file nvtx_profiler.h.

Here is the call graph for this function:

◆ ~NvtxProfiler()

hh::NvtxProfiler::~NvtxProfiler ( )
inline

Destructor, deletes all attributes allocated.

Definition at line 124 of file nvtx_profiler.h.

Member Function Documentation

◆ addReleaseMarker()

void hh::NvtxProfiler::addReleaseMarker ( )
inline

Adds hedgehog release marker into the timeline to show when the task released memory.

Definition at line 179 of file nvtx_profiler.h.

◆ createEventAttribute()

static nvtxEventAttributes_t * hh::NvtxProfiler::createEventAttribute ( uint32_t  color)
inlinestaticprivate

Creates an event attribute with hedgehog specified color.

Parameters
colorthe color shown in the timeline view

Definition at line 263 of file nvtx_profiler.h.

Here is the caller graph for this function:

◆ endRangeExecuting()

void hh::NvtxProfiler::endRangeExecuting ( )
inline

Ends tracking the execute for hedgehog task.

Definition at line 232 of file nvtx_profiler.h.

◆ endRangeInitializing()

void hh::NvtxProfiler::endRangeInitializing ( )
inline

Ends tracking the initialization phase for hedgehog task.

Definition at line 225 of file nvtx_profiler.h.

◆ endRangeShuttingDown()

void hh::NvtxProfiler::endRangeShuttingDown ( )
inline

Ends tracking the shutdown phase for hedgehog task.

Definition at line 253 of file nvtx_profiler.h.

◆ endRangeWaiting()

void hh::NvtxProfiler::endRangeWaiting ( )
inline

Ends tracking the waiting for data for hedgehog task.

Definition at line 239 of file nvtx_profiler.h.

◆ endRangeWaitingForMem()

void hh::NvtxProfiler::endRangeWaitingForMem ( )
inline

Ends tracking the waiting for memory from hedgehog memory edge.

Definition at line 246 of file nvtx_profiler.h.

◆ initialize()

void hh::NvtxProfiler::initialize ( int  threadId)
inline

Initializes the NvtxProfiler, and adds the threadId that is associated with the task.

Initialization of the NvtxProfiler creates and cache's the string names of the various event attributes

Parameters
threadIdthe thread identifier

Definition at line 141 of file nvtx_profiler.h.

◆ startRangeExecuting()

void hh::NvtxProfiler::startRangeExecuting ( )
inline

Starts tracking execution in the timeline to show when the task has started executing on data.

Definition at line 193 of file nvtx_profiler.h.

◆ startRangeInitializing()

void hh::NvtxProfiler::startRangeInitializing ( )
inline

Starts tracking intialization in the timeline to show when the task has started its initialization phase.

Definition at line 186 of file nvtx_profiler.h.

◆ startRangeShuttingDown()

void hh::NvtxProfiler::startRangeShuttingDown ( )
inline

Starts tracking shutdown in the timeline to show when the task has started its shutdown phase.

Definition at line 218 of file nvtx_profiler.h.

◆ startRangeWaiting()

void hh::NvtxProfiler::startRangeWaiting ( size_t const &  queueSize)
inline

Starts tracking execution in the timeline to show when the task has started waiting for data.

This event shows the current queue size in the payload within the attribute.

Parameters
queueSizethe queue size

Definition at line 202 of file nvtx_profiler.h.

◆ startRangeWaitingForMemory()

void hh::NvtxProfiler::startRangeWaitingForMemory ( )
inline

Starts tracking waiting for memory in the timeline to show when the task has started waiting for memory from hedgehog memory manager.

Definition at line 211 of file nvtx_profiler.h.

Member Data Documentation

◆ executeAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::executeAttrib_
private

The execute attribute.

Definition at line 78 of file nvtx_profiler.h.

◆ executeName_

std::string hh::NvtxProfiler::executeName_ {}
private

Name for the execute attribute.

Definition at line 62 of file nvtx_profiler.h.

◆ executeRangeId_

nvtxRangeId_t hh::NvtxProfiler::executeRangeId_ = 0
private

Range identifier for execute.

Definition at line 85 of file nvtx_profiler.h.

◆ executeString_

nvtxStringHandle_t hh::NvtxProfiler::executeString_ {}
private

Cache'd string used within the execute attribute.

Definition at line 71 of file nvtx_profiler.h.

◆ initializeAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::initializeAttrib_
private

The initialize attribute.

Definition at line 77 of file nvtx_profiler.h.

◆ initializeName_

std::string hh::NvtxProfiler::initializeName_ {}
private

Name for the initialization attribute.

Definition at line 61 of file nvtx_profiler.h.

◆ initializeRangeId_

nvtxRangeId_t hh::NvtxProfiler::initializeRangeId_ = 0
private

Range identifier for initialize.

Definition at line 84 of file nvtx_profiler.h.

◆ initializeString_

nvtxStringHandle_t hh::NvtxProfiler::initializeString_ {}
private

Cache'd string used within the initialize attribute.

Definition at line 70 of file nvtx_profiler.h.

◆ releaseMemAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::releaseMemAttrib_
private

The release memory attribute.

Definition at line 81 of file nvtx_profiler.h.

◆ releaseMemName_

std::string hh::NvtxProfiler::releaseMemName_ {}
private

Name for the release memory attribute.

Definition at line 65 of file nvtx_profiler.h.

◆ releaseMemString_

nvtxStringHandle_t hh::NvtxProfiler::releaseMemString_ {}
private

Cache'd string used within the release memory attribute.

Definition at line 74 of file nvtx_profiler.h.

◆ shutdownAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::shutdownAttrib_
private

The shutdown attribute.

Definition at line 82 of file nvtx_profiler.h.

◆ shutdownName_

std::string hh::NvtxProfiler::shutdownName_ {}
private

Name for the shutdown attribute.

Definition at line 66 of file nvtx_profiler.h.

◆ shutdownRangeId_

nvtxRangeId_t hh::NvtxProfiler::shutdownRangeId_ = 0
private

Range identifier for shutdown.

Definition at line 88 of file nvtx_profiler.h.

◆ shutdownString_

nvtxStringHandle_t hh::NvtxProfiler::shutdownString_ {}
private

Cache'd string used within the shutdown attribute.

Definition at line 75 of file nvtx_profiler.h.

◆ taskDomain_

nvtxDomainHandle_t hh::NvtxProfiler::taskDomain_
private

The domain for the task.

Definition at line 68 of file nvtx_profiler.h.

◆ waitAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::waitAttrib_
private

The wait attribute.

Definition at line 79 of file nvtx_profiler.h.

◆ waitForMemAttrib_

nvtxEventAttributes_t* hh::NvtxProfiler::waitForMemAttrib_
private

The wait for memory attribute.

Definition at line 80 of file nvtx_profiler.h.

◆ waitForMemName_

std::string hh::NvtxProfiler::waitForMemName_ {}
private

Name for the wait for memory attribute.

Definition at line 64 of file nvtx_profiler.h.

◆ waitForMemRangeId_

nvtxRangeId_t hh::NvtxProfiler::waitForMemRangeId_ = 0
private

Range identifier for wait for memory.

Definition at line 87 of file nvtx_profiler.h.

◆ waitForMemString_

nvtxStringHandle_t hh::NvtxProfiler::waitForMemString_ {}
private

Cache'd string used within the wait for memory attribute.

Definition at line 73 of file nvtx_profiler.h.

◆ waitName_

std::string hh::NvtxProfiler::waitName_ {}
private

Name for the wait attribute.

Definition at line 63 of file nvtx_profiler.h.

◆ waitRangeId_

nvtxRangeId_t hh::NvtxProfiler::waitRangeId_ = 0
private

Range identifier for wait (for data)

Definition at line 86 of file nvtx_profiler.h.

◆ waitString_

nvtxStringHandle_t hh::NvtxProfiler::waitString_ {}
private

Cache'd string used within the wait attribute.

Definition at line 72 of file nvtx_profiler.h.