TimingMacros: add definitions for using tracy

This commit is contained in:
Arne Morten Kvarving
2023-08-15 14:28:28 +02:00
parent ed8489ada6
commit 89deeea9d5

View File

@@ -19,8 +19,21 @@
#ifndef OPM_TIMINGMACROS_HPP
#define OPM_TIMINGMACROS_HPP
// macros used to time blocks for example with tracy
// time block of main part of codes which do not effect performance
// This file defines macros
// OPM_TIMEBLOCK - time block of main part of codes which do not effect performance
// OPM_TIMEBLOCK_LOCAL - detailed timing which may effect performance
#define DETAILED_PROFILING 0 // set to 1 to enable invasive profiling
#if USE_TRACY
#define TRACY_ENABLE 1
#include <tracy/Tracy.hpp>
#define OPM_TIMEBLOCK(blockname) ZoneNamedN(blockname, #blockname, true)
#if DETAILED_PROFILING
#define OPM_TIMEBLOCK_LOCAL(blockname) ZoneNamedN(blockname, #blockname, true)
#endif
#endif
#ifndef OPM_TIMEBLOCK
#define OPM_TIMEBLOCK(x)\
do { /* nothing */ } while (false)
@@ -32,4 +45,6 @@
do { /* nothing */ } while (false)
#endif
#undef DETAILED_PROFILING
#endif // OPM_TIMINGMACROS_HPP