NvtxUniqueRange#

public class NvtxUniqueRange implements AutoCloseable#

This class supports start/end NVTX profiling ranges.

Start/end:

The constructor instantiates a new NVTX range and keeps a unique handle that comes back from the NVTX api (nvtxRangeId). The handle is used to later close such a range. This type of range does not have the same order-of-operation requirements that the push/pop ranges have: the NvtxUniqueRange instance can be passed to other scopes, and even to other threads for the eventual call to close.

It can be used in the same try-with-resources way as push/pop, or interleaved with other ranges, like so:

  NvtxUniqueRange a = new NvtxUniqueRange("a", NvtxColor.RED);
  NvtxUniqueRange b = new NvtxUniqueRange("b", NvtxColor.BLUE);
  a.close();
  b.close();

Constructor Summary

Method Summary

Constructors

public NvtxUniqueRange(String name, NvtxColor color)#
public NvtxUniqueRange(String name, int colorBits)#

Methods

public void close()#