OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nvtx_helpers Namespace Reference

Namespaces

 anonymous_namespace{nvtx_helpers.cpp}
 

Classes

struct  CategoryInfo
 

Enumerations

enum  Category { Category::kNone, Category::kDebugTimer, Category::kQueryStateTimer, Category::kRenderLogger }
 

Functions

void init ()
 
void shutdown ()
 
const nvtxDomainHandle_t get_omnisci_domain ()
 
void omnisci_range_push (Category c, const char *name, const char *file)
 
void omnisci_range_pop ()
 
nvtxRangeId_t omnisci_range_start (Category c, const char *name)
 
void omnisci_range_end (nvtxRangeId_t r)
 
void omnisci_set_mark (Category c, const char *name)
 
void name_current_thread (const char *name)
 
void name_category (uint32_t category, const char *name)
 
void name_domain_category (nvtxDomainHandle_t domain, uint32_t category, const char *name)
 
void set_mark (const char *)
 
void range_push (const char *)
 
void range_pop ()
 
nvtxRangeId_t range_start (const char *)
 
nvtxRangeId_t range_start (const char *, uint32_t, uint32_t)
 
void range_end (nvtxRangeId_t)
 
nvtxDomainHandle_t create_domain (const char *)
 
void destroy_domain (nvtxDomainHandle_t)
 
void set_domain_mark (nvtxDomainHandle_t, const char *, uint32_t)
 
void domain_range_push (nvtxDomainHandle_t, const char *, uint32_t, uint32_t)
 
void domain_range_pop (nvtxDomainHandle_t)
 

Variables

static std::array
< CategoryInfo, NUM_CATEGORIES
g_category_infos = {}
 
static nvtxDomainHandle_t g_omnisci_domain = nullptr
 

Enumeration Type Documentation

Function Documentation

nvtxDomainHandle_t nvtx_helpers::create_domain ( const char *  )
inline

Definition at line 255 of file nvtx_helpers.h.

255  {
256  return nullptr;
257 }
void nvtx_helpers::destroy_domain ( nvtxDomainHandle_t  )
inline

Definition at line 258 of file nvtx_helpers.h.

258 {}
void nvtx_helpers::domain_range_pop ( nvtxDomainHandle_t  )
inline

Definition at line 261 of file nvtx_helpers.h.

261 {}
void nvtx_helpers::domain_range_push ( nvtxDomainHandle_t  ,
const char *  ,
uint32_t  ,
uint32_t   
)
inline

Definition at line 260 of file nvtx_helpers.h.

260 {}
const nvtxDomainHandle_t nvtx_helpers::get_omnisci_domain ( )

Definition at line 57 of file nvtx_helpers.cpp.

References g_omnisci_domain.

57  {
58  return g_omnisci_domain;
59 }
static nvtxDomainHandle_t g_omnisci_domain
void nvtx_helpers::init ( )
inline

Definition at line 32 of file nvtx_helpers.cpp.

References CHECK_LT, g_category_infos, g_omnisci_domain, kDebugTimer, kQueryStateTimer, kRenderLogger, setup::name, and NUM_CATEGORIES.

Referenced by logger::init().

32  {
33  // The domain will be null if NVTX profiling is not enabled by the nsys launcher
34  g_omnisci_domain = nvtxDomainCreateA("Omnisci");
35  if (g_omnisci_domain) {
36  auto create_category = [](Category c, const char* name, uint32_t color) {
37  auto category_index = static_cast<uint32_t>(c);
38  CHECK_LT(category_index, NUM_CATEGORIES);
39  g_category_infos[category_index] = {category_index, color};
40  nvtxDomainNameCategoryA(g_omnisci_domain, category_index, name);
41  };
42  // skip category 0 (none), as trying to modify it triggers errors during nsight
43  // analysis
44  create_category(Category::kDebugTimer, "DebugTimer", 0xFFB0E0E6);
45  create_category(Category::kQueryStateTimer, "QueryStateTimer", 0xFF98FB98);
46  create_category(Category::kRenderLogger, "RenderLogger", 0xFFEE8AA);
47  }
48 }
string name
Definition: setup.in.py:72
static std::array< CategoryInfo, NUM_CATEGORIES > g_category_infos
static nvtxDomainHandle_t g_omnisci_domain
#define CHECK_LT(x, y)
Definition: Logger.h:219
#define NUM_CATEGORIES

+ Here is the caller graph for this function:

void nvtx_helpers::name_category ( uint32_t  category,
const char *  name 
)
inline

Definition at line 239 of file nvtx_helpers.h.

239 {}
void nvtx_helpers::name_current_thread ( const char *  name)
inline

Definition at line 131 of file nvtx_helpers.cpp.

References logger::thread_id().

131  {
132 #ifdef _WIN32
133  uint32_t thread_id = GetCurrentThreadId();
134 #else
135 #ifdef SYS_gettid
136  uint32_t thread_id = static_cast<uint32_t>(syscall(SYS_gettid));
137 #else // SYS_gettid
138 #error "SYS_gettid unavailable on this system"
139 #endif // SYS_gettid
140 #endif // _WIN32
141  nvtxNameOsThreadA(thread_id, name);
142 }
string name
Definition: setup.in.py:72
ThreadId thread_id()
Definition: Logger.cpp:791

+ Here is the call graph for this function:

void nvtx_helpers::name_domain_category ( nvtxDomainHandle_t  domain,
uint32_t  category,
const char *  name 
)
inline

Definition at line 240 of file nvtx_helpers.h.

242  {}
void nvtx_helpers::omnisci_range_end ( nvtxRangeId_t  r)
inline

Definition at line 118 of file nvtx_helpers.cpp.

References g_omnisci_domain.

118  {
119  if (g_omnisci_domain) {
120  nvtxDomainRangeEnd(g_omnisci_domain, r);
121  }
122 }
static nvtxDomainHandle_t g_omnisci_domain
void nvtx_helpers::omnisci_range_pop ( )
inline

Definition at line 103 of file nvtx_helpers.cpp.

References g_omnisci_domain.

Referenced by logger::DebugTimer::~DebugTimer(), and query_state::Timer::~Timer().

103  {
104  if (g_omnisci_domain) {
105  nvtxDomainRangePop(g_omnisci_domain);
106  }
107 }
static nvtxDomainHandle_t g_omnisci_domain

+ Here is the caller graph for this function:

void nvtx_helpers::omnisci_range_push ( Category  c,
const char *  name,
const char *  file 
)
inline

Definition at line 87 of file nvtx_helpers.cpp.

References nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::filename(), g_omnisci_domain, nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::make_omnisci_event(), and setup::name.

Referenced by logger::DebugTimer::DebugTimer(), and query_state::Timer::Timer().

87  {
88  if (g_omnisci_domain) {
89  if (file) {
90  std::stringstream ss;
91  ss << name;
92  ss << " | " << filename(file);
93  auto str = ss.str();
94  auto event = make_omnisci_event(c, str.c_str());
95  nvtxDomainRangePushEx(g_omnisci_domain, &event);
96  } else {
97  auto event = make_omnisci_event(c, name);
98  nvtxDomainRangePushEx(g_omnisci_domain, &event);
99  }
100  }
101 }
string name
Definition: setup.in.py:72
static nvtxDomainHandle_t g_omnisci_domain
nvtxEventAttributes_t make_omnisci_event(Category c, const char *name)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

nvtxRangeId_t nvtx_helpers::omnisci_range_start ( Category  c,
const char *  name 
)
inline

Definition at line 109 of file nvtx_helpers.cpp.

References g_omnisci_domain, and nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::make_omnisci_event().

109  {
110  if (g_omnisci_domain) {
111  auto event = make_omnisci_event(c, name);
112  return nvtxDomainRangeStartEx(g_omnisci_domain, &event);
113  } else {
114  return nvtxRangeId_t{};
115  }
116 }
string name
Definition: setup.in.py:72
static nvtxDomainHandle_t g_omnisci_domain
uint64_t nvtxRangeId_t
Definition: nvtx_helpers.h:26
nvtxEventAttributes_t make_omnisci_event(Category c, const char *name)

+ Here is the call graph for this function:

void nvtx_helpers::omnisci_set_mark ( Category  c,
const char *  name 
)
inline

Definition at line 124 of file nvtx_helpers.cpp.

References g_omnisci_domain, and nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::make_omnisci_event().

124  {
125  if (g_omnisci_domain) {
126  auto event = make_omnisci_event(c, name);
127  nvtxDomainMarkEx(g_omnisci_domain, &event);
128  }
129 }
string name
Definition: setup.in.py:72
static nvtxDomainHandle_t g_omnisci_domain
nvtxEventAttributes_t make_omnisci_event(Category c, const char *name)

+ Here is the call graph for this function:

void nvtx_helpers::range_end ( nvtxRangeId_t  )
inline

Definition at line 253 of file nvtx_helpers.h.

253 {}
void nvtx_helpers::range_pop ( )
inline

Definition at line 246 of file nvtx_helpers.h.

246 {}
void nvtx_helpers::range_push ( const char *  )
inline

Definition at line 245 of file nvtx_helpers.h.

245 {}
nvtxRangeId_t nvtx_helpers::range_start ( const char *  )
inline

Definition at line 247 of file nvtx_helpers.h.

247  {
248  return nvtxRangeId_t{};
249 }
uint64_t nvtxRangeId_t
Definition: nvtx_helpers.h:26
nvtxRangeId_t nvtx_helpers::range_start ( const char *  ,
uint32_t  ,
uint32_t   
)
inline

Definition at line 250 of file nvtx_helpers.h.

250  {
251  return nvtxRangeId_t{};
252 }
uint64_t nvtxRangeId_t
Definition: nvtx_helpers.h:26
void nvtx_helpers::set_domain_mark ( nvtxDomainHandle_t  ,
const char *  ,
uint32_t   
)
inline

Definition at line 259 of file nvtx_helpers.h.

259 {}
void nvtx_helpers::set_mark ( const char *  )
inline

Definition at line 244 of file nvtx_helpers.h.

244 {}
void nvtx_helpers::shutdown ( )
inline

Definition at line 50 of file nvtx_helpers.cpp.

References g_omnisci_domain.

Referenced by logger::shutdown().

50  {
51  if (g_omnisci_domain) {
52  nvtxDomainDestroy(g_omnisci_domain);
53  g_omnisci_domain = nullptr;
54  }
55 }
static nvtxDomainHandle_t g_omnisci_domain

+ Here is the caller graph for this function:

Variable Documentation

std::array<CategoryInfo, NUM_CATEGORIES> nvtx_helpers::g_category_infos = {}
static
nvtxDomainHandle_t nvtx_helpers::g_omnisci_domain = nullptr
static