OmniSciDB  72c90bc290
 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 73 of file nvtx_helpers.cpp.

References g_omnisci_domain.

73  {
74  return g_omnisci_domain;
75 }
static nvtxDomainHandle_t g_omnisci_domain
void nvtx_helpers::init ( )
inline

Definition at line 48 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().

48  {
49  // The domain will be null if NVTX profiling is not enabled by the nsys launcher
50  g_omnisci_domain = nvtxDomainCreateA("Omnisci");
51  if (g_omnisci_domain) {
52  auto create_category = [](Category c, const char* name, uint32_t color) {
53  auto category_index = static_cast<uint32_t>(c);
54  CHECK_LT(category_index, NUM_CATEGORIES);
55  g_category_infos[category_index] = {category_index, color};
56  nvtxDomainNameCategoryA(g_omnisci_domain, category_index, name);
57  };
58  // skip category 0 (none), as trying to modify it triggers errors during nsight
59  // analysis
60  create_category(Category::kDebugTimer, "DebugTimer", 0xFFB0E0E6);
61  create_category(Category::kQueryStateTimer, "QueryStateTimer", 0xFF98FB98);
62  create_category(Category::kRenderLogger, "RenderLogger", 0xFFEE8AA);
63  }
64 }
static std::array< CategoryInfo, NUM_CATEGORIES > g_category_infos
static nvtxDomainHandle_t g_omnisci_domain
#define CHECK_LT(x, y)
Definition: Logger.h:303
#define NUM_CATEGORIES
string name
Definition: setup.in.py:72

+ 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 147 of file nvtx_helpers.cpp.

References logger::thread_id().

147  {
148 #ifdef _WIN32
149  uint32_t thread_id = GetCurrentThreadId();
150 #else
151 #ifdef SYS_gettid
152  uint32_t thread_id = static_cast<uint32_t>(syscall(SYS_gettid));
153 #else // SYS_gettid
154 #error "SYS_gettid unavailable on this system"
155 #endif // SYS_gettid
156 #endif // _WIN32
157  nvtxNameOsThreadA(thread_id, name);
158 }
ThreadId thread_id()
Definition: Logger.cpp:877
string name
Definition: setup.in.py:72

+ 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 134 of file nvtx_helpers.cpp.

References g_omnisci_domain.

134  {
135  if (g_omnisci_domain) {
136  nvtxDomainRangeEnd(g_omnisci_domain, r);
137  }
138 }
static nvtxDomainHandle_t g_omnisci_domain
void nvtx_helpers::omnisci_range_pop ( )
inline

Definition at line 119 of file nvtx_helpers.cpp.

References g_omnisci_domain.

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

119  {
120  if (g_omnisci_domain) {
121  nvtxDomainRangePop(g_omnisci_domain);
122  }
123 }
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 103 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 query_state::Timer::Timer().

103  {
104  if (g_omnisci_domain) {
105  if (file) {
106  std::stringstream ss;
107  ss << name;
108  ss << " | " << filename(file);
109  auto str = ss.str();
110  auto event = make_omnisci_event(c, str.c_str());
111  nvtxDomainRangePushEx(g_omnisci_domain, &event);
112  } else {
113  auto event = make_omnisci_event(c, name);
114  nvtxDomainRangePushEx(g_omnisci_domain, &event);
115  }
116  }
117 }
static nvtxDomainHandle_t g_omnisci_domain
nvtxEventAttributes_t make_omnisci_event(Category c, const char *name)
string name
Definition: setup.in.py:72

+ 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 125 of file nvtx_helpers.cpp.

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

125  {
126  if (g_omnisci_domain) {
127  auto event = make_omnisci_event(c, name);
128  return nvtxDomainRangeStartEx(g_omnisci_domain, &event);
129  } else {
130  return nvtxRangeId_t{};
131  }
132 }
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)
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

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

Definition at line 140 of file nvtx_helpers.cpp.

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

140  {
141  if (g_omnisci_domain) {
142  auto event = make_omnisci_event(c, name);
143  nvtxDomainMarkEx(g_omnisci_domain, &event);
144  }
145 }
static nvtxDomainHandle_t g_omnisci_domain
nvtxEventAttributes_t make_omnisci_event(Category c, const char *name)
string name
Definition: setup.in.py:72

+ 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.

Referenced by StringDictionaryProxy::TranslationMap< Datum >::setRangeEnd().

253 {}

+ Here is the caller graph for this function:

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.

Referenced by StringDictionaryProxy::TranslationMap< Datum >::setRangeStart().

247  {
248  return nvtxRangeId_t{};
249 }
uint64_t nvtxRangeId_t
Definition: nvtx_helpers.h:26

+ Here is the caller graph for this function:

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 66 of file nvtx_helpers.cpp.

References g_omnisci_domain.

Referenced by logger::shutdown().

66  {
67  if (g_omnisci_domain) {
68  nvtxDomainDestroy(g_omnisci_domain);
69  g_omnisci_domain = nullptr;
70  }
71 }
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