2
0

SWDEV-457922: Temporary fix to prevent multiple instances of either rocprofiler v1 or v2 to be running, whether it's interception or standalone mode.

The fix works by using a pid file and a lock file, similar to how firefox prevents multiple instances.

Change-Id: I4974a80bf920eaf0376a53410573c1cc74ec17ac


[ROCm/rocprofiler commit: 056156135d]
Este cometimento está contido em:
Saurabh Verma
2024-05-17 18:32:06 -05:00
ascendente d7c2fa8867
cometimento c41bbe21d0
7 ficheiros modificados com 176 adições e 4 eliminações
+5 -2
Ver ficheiro
@@ -70,7 +70,8 @@ set(OLD_LIB_SRC
${LIB_DIR}/core/intercept_queue.cpp
${LIB_DIR}/core/metrics.cpp
${LIB_DIR}/core/activity.cpp
${LIB_DIR}/util/hsa_rsrc_factory.cpp)
${LIB_DIR}/util/hsa_rsrc_factory.cpp
${LIB_DIR}/core/profiling_lock.cpp)
# ########################################################################################
# Configuring Basic/Derived Counters
@@ -213,6 +214,7 @@ file(GLOB CORE_SESSION_SRC_FILES ${CORE_SESSION_DIR}/session.cpp)
file(GLOB CORE_FILTER_SRC_FILES ${CORE_SESSION_DIR}/filter.cpp)
file(GLOB CORE_DEVICE_PROFILING_SRC_FILES ${CORE_SESSION_DIR}/device_profiling.cpp)
file(GLOB CORE_COUNTERS_SAMPLER_SRC_FILES ${CORE_SESSION_DIR}/counters_sampler.cpp)
file(GLOB CORE_PROFILING_LOCK_FILES ${PROJECT_SOURCE_DIR}/src/core/profiling_lock.cpp)
file(GLOB CORE_COUNTERS_SRC_FILES ${PROJECT_BINARY_DIR}/src/api/*_counter.cpp)
file(GLOB CORE_COUNTERS_PARENT_SRC_FILES ${PROJECT_SOURCE_DIR}/src/core/counters/*.cpp)
@@ -289,7 +291,8 @@ add_library(
${ROCPROFILER_ROCTRACER_SRC_FILES}
${GENERATED_SOURCES}
${CORE_COUNTERS_SRC_FILES}
${CORE_PC_SAMPLING_FILES})
${CORE_PC_SAMPLING_FILES}
${CORE_PROFILING_LOCK_FILES})
set_target_properties(
rocprofiler-v2
PROPERTIES CXX_VISIBILITY_PRESET hidden
+2
Ver ficheiro
@@ -9,6 +9,7 @@
#include "src/api/rocprofiler_singleton.h"
#include "src/utils/helper.h"
#include "src/core/isa_capture/code_object_track.hpp"
#include "core/profiling_lock.h"
// TODO(aelwazir): change that to adapt with our own Exception
// What about outside exceptions and callbacks exceptions!!
@@ -617,6 +618,7 @@ ROCPROFILER_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
uint64_t failed_tool_count, const char* const* failed_tool_names) {
if (started) rocprofiler::fatal("HSA Tool started already!");
started = true;
ProfilingLock::Lock(PROFILER_V2_LOCK);
rocprofiler::HSASupport_Singleton::GetInstance().HSAInitialize(table);
return true;
}