|
FEAT 3
Finite Element Analysis Toolbox
|
Stack manager for nested NVTX profiling ranges. More...
#include <cuda_util.hpp>
Public Member Functions | |
| NvtxRangeStack (const NvtxRangeStack &)=delete | |
| stacks must not be copied (ownership of open range ids is unique) | |
| ~NvtxRangeStack () | |
| closes all ranges that are still open More... | |
| NvtxRangeStack & | operator= (const NvtxRangeStack &)=delete |
| void | pop () |
| closes the most recently opened range (no-op if the stack is empty) More... | |
| void | push (const char *name) |
| opens a new named range and pushes it onto the stack More... | |
| std::size_t | size () const |
| returns the number of currently open ranges More... | |
Private Attributes | |
| std::vector< std::uint64_t > | _ids |
| the ids of the currently open ranges (LIFO order) More... | |
Stack manager for nested NVTX profiling ranges.
Abstracts the paired Util::cuda_start_range / Util::cuda_stop_range calls behind a push/pop stack: push() opens a named range and stores its id, pop() closes the most recently opened one (LIFO). The destructor closes any ranges still open, so an early return or a thrown exception cannot leak a dangling range.
All operations are no-ops unless FEAT_HAVE_CUDA is defined.
Definition at line 186 of file cuda_util.hpp.
|
inline |
closes all ranges that are still open
Definition at line 200 of file cuda_util.hpp.
|
inline |
closes the most recently opened range (no-op if the stack is empty)
Definition at line 215 of file cuda_util.hpp.
References _ids.
Referenced by ~NvtxRangeStack(), and FEAT::Util::ScopedNvtxRange::~ScopedNvtxRange().
|
inline |
opens a new named range and pushes it onto the stack
Definition at line 207 of file cuda_util.hpp.
References _ids.
Referenced by FEAT::Util::ScopedNvtxRange::ScopedNvtxRange().
|
inline |
returns the number of currently open ranges
Definition at line 227 of file cuda_util.hpp.
References _ids.
|
private |
the ids of the currently open ranges (LIFO order)
Definition at line 190 of file cuda_util.hpp.
Referenced by ~NvtxRangeStack(), pop(), push(), and size().