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]
This commit is contained in:
Saurabh Verma
2024-05-17 18:32:06 -05:00
parent d7c2fa8867
commit c41bbe21d0
7 changed files with 176 additions and 4 deletions
@@ -58,6 +58,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)
set(CORE_HW_DIR ${PROJECT_SOURCE_DIR}/src/core/hardware)
file(GLOB CORE_HW_SRC_FILES ${CORE_HW_DIR}/hsa_info.cpp)
@@ -209,7 +210,8 @@ set(runCoreUnitTests_SOURCES
${CORE_COUNTERS_METRICS_SRC_FILES}
${CORE_COUNTERS_MMIO_SRC_FILES}
${CORE_COUNTERS_PARENT_SRC_FILES}
${CORE_PC_SAMPLING_FILES})
${CORE_PC_SAMPLING_FILES}
${CORE_PROFILING_LOCK_FILES})
add_executable(runCoreUnitTests ${runCoreUnitTests_SOURCES})
@@ -36,6 +36,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)
set(CORE_HW_DIR ${PROJECT_SOURCE_DIR}/src/core/hardware)
file(GLOB CORE_HW_SRC_FILES ${CORE_HW_DIR}/hsa_info.cpp)
@@ -104,7 +105,8 @@ set(runUnitTests_SOURCES
${CORE_COUNTERS_METRICS_SRC_FILES}
${CORE_COUNTERS_MMIO_SRC_FILES}
${CORE_COUNTERS_PARENT_SRC_FILES}
${CORE_PC_SAMPLING_FILES})
${CORE_PC_SAMPLING_FILES}
${CORE_PROFILING_LOCK_FILES})
add_executable(runUnitTests ${runUnitTests_SOURCES})