14#include "arcane/std/Otf2MessagePassingProfilingService.h"
16#include "arcane/utils/ITraceMng.h"
19#include "arcane/core/CommonVariables.h"
20#include "arcane/core/IMesh.h"
21#include "arcane/core/IItemFamily.h"
22#include "arcane/core/IVariableSynchronizer.h"
23#include "arcane/core/ITimeLoopMng.h"
24#include "arcane/core/IParallelMng.h"
25#include "arcane/core/IEntryPoint.h"
27#include "arcane/parallel/IStat.h"
29#include "arccore/message_passing/IMessagePassingMng.h"
30#include "arccore/message_passing/IDispatchers.h"
31#include "arccore/message_passing/IControlDispatcher.h"
52Otf2MessagePassingProfilingService::
55, m_sub_domain(sbi.subDomain())
56, m_otf2_wrapper(sbi.subDomain())
57, m_otf2_prof(&m_otf2_wrapper)
58, m_prof_backup(nullptr)
59, m_impl_name(
"Otf2MessagePassingProfiling")
66Otf2MessagePassingProfilingService::
67~Otf2MessagePassingProfilingService() noexcept
74void Otf2MessagePassingProfilingService::
81 m_otf2_wrapper.init(m_sub_domain->application()->applicationName());
85 m_control_dispatcher = cd;
88 m_prof_backup = cd->profiler();
91 cd->setProfiler(&m_otf2_prof);
95 m_observer.addObserver(
this, &Otf2MessagePassingProfilingService::_updateFromBeginEntryPointEvt,
96 m_sub_domain->timeLoopMng()->observable(eTimeLoopEventType::BeginEntryPoint));
99 m_observer.addObserver(
this, &Otf2MessagePassingProfilingService::_updateFromEndEntryPointEvt,
100 m_sub_domain->timeLoopMng()->observable(eTimeLoopEventType::EndEntryPoint));
103 auto sync_evt_handler = std::function<void(const Arcane::VariableSynchronizerEventArgs&)>(
104 std::bind(&Otf2MessagePassingProfilingService::_updateFromSynchronizeEvt,
this, std::placeholders::_1));
107 m_sub_domain->defaultMesh()->cellFamily()->allItemsSynchronizer()->onSynchronized().attach(m_observer_pool,
110 m_sub_domain->defaultMesh()->nodeFamily()->allItemsSynchronizer()->onSynchronized().attach(m_observer_pool,
113 m_sub_domain->defaultMesh()->edgeFamily()->allItemsSynchronizer()->onSynchronized().attach(m_observer_pool,
116 m_sub_domain->defaultMesh()->faceFamily()->allItemsSynchronizer()->onSynchronized().attach(m_observer_pool,
122 m_otf2_wrapper.getApplicationNameId(), 0, NULL);
128void Otf2MessagePassingProfilingService::
132 if (m_control_dispatcher)
133 m_control_dispatcher->setProfiler(m_prof_backup);
137 m_otf2_wrapper.finalize();
140 m_observer.detachAll();
145void Otf2MessagePassingProfilingService::
146printInfos(std::ostream& output)
148 ARCANE_UNUSED(output);
154String Otf2MessagePassingProfilingService::
163void Otf2MessagePassingProfilingService::
164_updateFromBeginEntryPointEvt()
167 const String& ep_name(m_sub_domain->timeLoopMng()->currentEntryPoint()->fullName());
170 m_otf2_wrapper.getEntryPointId(ep_name));
176void Otf2MessagePassingProfilingService::
177_updateFromEndEntryPointEvt()
180 const String& ep_name(m_sub_domain->timeLoopMng()->currentEntryPoint()->fullName());
182 OTF2_EvtWriter_Leave(m_otf2_wrapper.getEventWriter(), NULL, Otf2LibWrapper::getTime(),
183 m_otf2_wrapper.getEntryPointId(ep_name));
189void Otf2MessagePassingProfilingService::
190_updateFromSynchronizeEvt(
const VariableSynchronizerEventArgs& arg)
192 if (arg.state() == VariableSynchronizerEventArgs::State::BeginSynchronize)
193 OTF2_EvtWriter_Enter(m_otf2_wrapper.getEventWriter(), NULL, Otf2LibWrapper::getTime(),
194 m_otf2_wrapper.getSynchronizeId());
196 OTF2_EvtWriter_Leave(m_otf2_wrapper.getEventWriter(), NULL, Otf2LibWrapper::getTime(),
197 m_otf2_wrapper.getSynchronizeId());
This file contains the various service factories and macros for registering services.
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro to declare an interface when registering a service.
Interface of a profiling service dedicated to "message passing".
Manage control streams for parallel messages.
Interface of the message passing manager.
static OTF2_TimeStamp getTime()
Internal static method to retrieve the timestamp.
Profiling service for "message passing" in JSON format.
Structure containing the information to create a service.
Service creation properties.
Unicode character string.
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro for registering a service.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
@ ST_SubDomain
The service is used at the subdomain level.