21#ifndef HEDGEHOG_NVTX_PROFILER_H
22#define HEDGEHOG_NVTX_PROFILER_H
25#include <nvtx3/nvToolsExt.h>
34#define NVTX_COLOR_INITIALIZING 0xFF123456
35#define NVTX_COLOR_EXECUTING 0xFF72ff68
36#define NVTX_COLOR_WAITING 0xFFff7f83
37#define NVTX_COLOR_WAITING_FOR_MEM 0xFFffc86a
38#define NVTX_COLOR_RELEASE_MEM 0xFF7fbdff
39#define NVTX_COLOR_SHUTTING_DOWN 0xFF654321
108 waitAttrib_->payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;
119 explicit NvtxProfiler(std::string const &) {}
135 ~NvtxProfiler() = default;
143 std::string prefixName(std::to_string(threadId));
164 waitAttrib_->messageType = NVTX_MESSAGE_TYPE_REGISTERED;
264 auto *
event =
new nvtxEventAttributes_t;
265 bzero(event, NVTX_EVENT_ATTRIB_STRUCT_SIZE);
266 event->version = NVTX_VERSION;
267 event->size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
268 event->colorType = NVTX_COLOR_ARGB;
269 event->color = color;
#define NVTX_COLOR_RELEASE_MEM
#define NVTX_COLOR_WAITING_FOR_MEM
#define NVTX_COLOR_INITIALIZING
#define NVTX_COLOR_SHUTTING_DOWN
#define NVTX_COLOR_EXECUTING
#define NVTX_COLOR_WAITING
A class to wrap calls to the NVTX library for tracking events that occur within an Hedgehog task grap...
void endRangeWaitingForMem()
Ends tracking the waiting for memory from hedgehog memory edge.
nvtxRangeId_t shutdownRangeId_
Range identifier for shutdown.
nvtxRangeId_t executeRangeId_
Range identifier for execute.
std::string executeName_
Name for the execute attribute.
std::string waitForMemName_
Name for the wait for memory attribute.
nvtxDomainHandle_t taskDomain_
The domain for the task.
nvtxStringHandle_t releaseMemString_
Cache'd string used within the release memory attribute.
void startRangeWaitingForMemory()
Starts tracking waiting for memory in the timeline to show when the task has started waiting for memo...
nvtxStringHandle_t shutdownString_
Cache'd string used within the shutdown attribute.
void endRangeShuttingDown()
Ends tracking the shutdown phase for hedgehog task.
nvtxEventAttributes_t * releaseMemAttrib_
The release memory attribute.
nvtxRangeId_t waitForMemRangeId_
Range identifier for wait for memory.
void endRangeExecuting()
Ends tracking the execute for hedgehog task.
nvtxEventAttributes_t * executeAttrib_
The execute attribute.
nvtxStringHandle_t waitString_
Cache'd string used within the wait attribute.
nvtxEventAttributes_t * shutdownAttrib_
The shutdown attribute.
void addReleaseMarker()
Adds hedgehog release marker into the timeline to show when the task released memory.
NvtxProfiler()=delete
Deleted default constructor.
void endRangeWaiting()
Ends tracking the waiting for data for hedgehog task.
void startRangeInitializing()
Starts tracking intialization in the timeline to show when the task has started its initialization ph...
static nvtxEventAttributes_t * createEventAttribute(uint32_t color)
Creates an event attribute with hedgehog specified color.
nvtxEventAttributes_t * initializeAttrib_
The initialize attribute.
std::string shutdownName_
Name for the shutdown attribute.
nvtxRangeId_t initializeRangeId_
Range identifier for initialize.
void startRangeExecuting()
Starts tracking execution in the timeline to show when the task has started executing on data.
void initialize(int threadId)
Initializes the NvtxProfiler, and adds the threadId that is associated with the task.
nvtxStringHandle_t initializeString_
Cache'd string used within the initialize attribute.
~NvtxProfiler()
Destructor, deletes all attributes allocated.
std::string waitName_
Name for the wait attribute.
void startRangeWaiting(size_t const &queueSize)
Starts tracking execution in the timeline to show when the task has started waiting for data.
nvtxRangeId_t waitRangeId_
Range identifier for wait (for data)
nvtxEventAttributes_t * waitAttrib_
The wait attribute.
nvtxEventAttributes_t * waitForMemAttrib_
The wait for memory attribute.
std::string initializeName_
Name for the initialization attribute.
nvtxStringHandle_t waitForMemString_
Cache'd string used within the wait for memory attribute.
NvtxProfiler(std::string const &taskName)
Constructs the NvtxProfiler with the name of the task.
void startRangeShuttingDown()
Starts tracking shutdown in the timeline to show when the task has started its shutdown phase.
nvtxStringHandle_t executeString_
Cache'd string used within the execute attribute.
void endRangeInitializing()
Ends tracking the initialization phase for hedgehog task.
std::string releaseMemName_
Name for the release memory attribute.