Skip to content

Commit 448203b

Browse files
committed
Log with NVTX too when doing PerfLog
1 parent 98b9694 commit 448203b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

include/utils/perf_log.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#ifndef LIBMESH_HAVE_GETTIMEOFDAY
3939
#include "libmesh/win_gettimeofday.h" // gettimeofday() on Windows
4040
#endif
41+
#ifdef LIBMESH_HAVE_NVTX_API
42+
#include <nvtx3/nvtx3.hpp>
43+
#endif
4144

4245
namespace libMesh
4346
{
@@ -505,6 +508,14 @@ void PerfLog::fast_push (const char * label,
505508
else
506509
perf_data->start();
507510
log_stack.push(perf_data);
511+
512+
#ifdef LIBMESH_HAVE_NVTX_API
513+
// This takes a single const char *, and we don't want to waste
514+
// time allocating a new string on every push, so for now we'll
515+
// drop the header. Maybe we should allocate a new string in
516+
// the PerfData?
517+
nvtxRangePushA(label);
518+
#endif
508519
}
509520
}
510521

@@ -516,6 +527,9 @@ void PerfLog::fast_pop(const char * libmesh_dbg_var(label),
516527
{
517528
if (this->log_events)
518529
{
530+
#ifdef LIBMESH_HAVE_NVTX_API
531+
nvtxRangePop();
532+
#endif
519533
// If there's nothing on the stack, then we can't pop anything. Previously we
520534
// asserted that the log_stack was not empty, but we should not throw from
521535
// this function, so instead just return in that case.

0 commit comments

Comments
 (0)