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]
这个提交包含在:
Saurabh Verma
2024-05-17 18:32:06 -05:00
父节点 d7c2fa8867
当前提交 c41bbe21d0
修改 7 个文件,包含 176 行新增4 行删除
@@ -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;
}