diff --git a/openmp/libomptarget/include/Shared/Profile.h b/openmp/libomptarget/include/Shared/Profile.h index 316b0c3086d04..19ca0cf227518 100644 --- a/openmp/libomptarget/include/Shared/Profile.h +++ b/openmp/libomptarget/include/Shared/Profile.h @@ -75,7 +75,7 @@ class Profiler { }; /// Time spend in the current scope, assigned to the function name. -#define TIMESCOPE() llvm::TimeTraceScope TimeScope(__FUNCTION__) +#define TIMESCOPE() llvm::TimeTraceScope TimeScope(__PRETTY_FUNCTION__) /// Time spend in the current scope, assigned to the function name and source /// info. diff --git a/openmp/libomptarget/src/OffloadRTL.cpp b/openmp/libomptarget/src/OffloadRTL.cpp index 061b053c68cc8..86ef0d5bc91cf 100644 --- a/openmp/libomptarget/src/OffloadRTL.cpp +++ b/openmp/libomptarget/src/OffloadRTL.cpp @@ -21,6 +21,9 @@ extern void llvm::omp::target::ompt::connectLibrary(); #endif __attribute__((constructor(101))) void init() { + Profiler::get(); + TIMESCOPE(); + DP("Init offload library!\n"); PM = new PluginManager(); @@ -32,7 +35,6 @@ __attribute__((constructor(101))) void init() { PM->init(); - Profiler::get(); PM->registerDelayedLibraries(); } diff --git a/openmp/libomptarget/src/PluginManager.cpp b/openmp/libomptarget/src/PluginManager.cpp index 16e04dde923d9..17787284441c5 100644 --- a/openmp/libomptarget/src/PluginManager.cpp +++ b/openmp/libomptarget/src/PluginManager.cpp @@ -12,6 +12,7 @@ #include "PluginManager.h" #include "Shared/Debug.h" +#include "Shared/Profile.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" @@ -28,6 +29,7 @@ static const char *RTLNames[] = {ENABLED_OFFLOAD_PLUGINS}; Expected> PluginAdaptorTy::create(const std::string &Name) { DP("Attempting to load library '%s'...\n", Name.c_str()); + TIMESCOPE_WITH_NAME_AND_IDENT(Name, (const ident_t *)nullptr); std::string ErrMsg; auto LibraryHandler = std::make_unique( @@ -101,6 +103,7 @@ void PluginAdaptorTy::addOffloadEntries(DeviceImageTy &DI) { } void PluginManager::init() { + TIMESCOPE(); DP("Loading RTLs...\n"); // Attempt to open all the plugins and, if they exist, check if the interface @@ -123,6 +126,7 @@ void PluginManager::init() { void PluginAdaptorTy::initDevices(PluginManager &PM) { if (isUsed()) return; + TIMESCOPE(); // If this RTL is not already in use, initialize it. assert(getNumberOfPluginDevices() > 0 &&