NVIDIA / NVTX

The NVIDIA® Tools Extension SDK (NVTX) is a C-based Application Programming Interface (API) for annotating events, code ranges, and resources in your applications.
Apache License 2.0
312 stars 48 forks source link

cpp: add conditional range macros #35

Closed AntoineFroger closed 3 years ago

AntoineFroger commented 3 years ago

Add the NVTX3_FUNC_RANGE_IF and NVTX3_FUNC_RANGE_IN_IF macros which are similar to the NVTX3_FUNC_RANGE and NVTX3_FUNC_RANGE_IN macros except that they only generate a range if the boolean expression passed as parameter evaluates to true.

Closes #28

AntoineFroger commented 3 years ago

I tested by compiling a simple piece of code using NVTX3_FUNC_RANGE_IF and NVTX3_FUNC_RANGE_IF_IN when the condition evaluates to both true and false. I profiled the executable with Nsight Systems to validate.

jcohen-nvidia commented 3 years ago

Looks good.