17#if (!defined(GPUCA_STANDALONE) || defined(GPUCA_BUILD_QA))
24std::weak_ptr<GPUROOTDumpCore> GPUROOTDumpCore::sInstance;
35 for (uint32_t
i = 0;
i < mBranches.size();
i++) {
36 mBranches[
i]->write();
42std::shared_ptr<GPUROOTDumpCore> GPUROOTDumpCore::getAndCreate(
const char*
filename)
44 static std::atomic_flag lock = ATOMIC_FLAG_INIT;
45 while (lock.test_and_set(std::memory_order_acquire)) {
47 std::shared_ptr<GPUROOTDumpCore>
retVal = sInstance.lock();
49 retVal = std::make_shared<GPUROOTDumpCore>(GPUROOTDumpCorePrivate());
53 throw std::runtime_error(
"GPUROOTDump reinitialized with different file name");
56 lock.clear(std::memory_order_release);
62 std::shared_ptr<GPUROOTDumpCore> p = GPUROOTDumpCore::get().lock();
64 throw std::runtime_error(
"No instance of GPUROOTDumpCore exists");
66 p->mBranches.emplace_back(
this);
68 if (p->mFileName ==
"") {
69 throw std::runtime_error(
"GPUROOTDump output file name not set");
71 std::remove(p->mFileName.c_str());
72 p->mFile.reset(
new TFile(p->mFileName.c_str(),
"recreate"));
static std::atomic_flag mMutex
GPUROOTDumpCore(const GPUROOTDumpCore &)=delete