From 560a1e913011ef26392d4e8b37a01d4999906760 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 11 Dec 2024 21:51:49 +0100 Subject: [PATCH] DPL: extra signposts for InitTask callback (#13793) --- Framework/Core/src/DataProcessingDevice.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Framework/Core/src/DataProcessingDevice.cxx b/Framework/Core/src/DataProcessingDevice.cxx index f4123de250e79..da92c73e1e16a 100644 --- a/Framework/Core/src/DataProcessingDevice.cxx +++ b/Framework/Core/src/DataProcessingDevice.cxx @@ -1008,6 +1008,9 @@ void DataProcessingDevice::InitTask() auto ref = ServiceRegistryRef{mServiceRegistry}; auto& deviceContext = ref.get(); auto& context = ref.get(); + + O2_SIGNPOST_ID_FROM_POINTER(cid, device, &context); + O2_SIGNPOST_START(device, cid, "InitTask", "Entering InitTask callback."); auto& spec = getRunningDevice(mRunningDevice, mServiceRegistry); auto distinct = DataRelayerHelpers::createDistinctRouteIndex(spec.inputs); auto& state = ref.get(); @@ -1098,10 +1101,13 @@ void DataProcessingDevice::InitTask() // We will get there. this->fillContext(mServiceRegistry.get(ServiceRegistry::globalDeviceSalt()), deviceContext); + O2_SIGNPOST_END(device, cid, "InitTask", "Exiting InitTask callback waiting for the remaining region callbacks."); + auto hasPendingEvents = [&mutex = mRegionInfoMutex, &pendingRegionInfos = mPendingRegionInfos](DeviceContext& deviceContext) { std::lock_guard lock(mutex); return (pendingRegionInfos.empty() == false) || deviceContext.expectedRegionCallbacks > 0; }; + O2_SIGNPOST_START(device, cid, "InitTask", "Waiting for registation events."); /// We now run an event loop also in InitTask. This is needed to: /// * Make sure region registration callbacks are invoked /// on the main thread. @@ -1111,10 +1117,12 @@ void DataProcessingDevice::InitTask() uv_run(state.loop, UV_RUN_ONCE); // Handle callbacks if any { + O2_SIGNPOST_EVENT_EMIT(device, cid, "InitTask", "Memory registration event received."); std::lock_guard lock(mRegionInfoMutex); handleRegionCallbacks(mServiceRegistry, mPendingRegionInfos); } } + O2_SIGNPOST_END(device, cid, "InitTask", "Done waiting for registration events."); } void DataProcessingDevice::fillContext(DataProcessorContext& context, DeviceContext& deviceContext)