7 #include <common/include/ProfilingGuid.hpp>
40 const std::string& name,
41 std::vector<InstrumentPtr>&& instruments,
44 template<
typename DescriptorType>
46 const DescriptorType& desc,
48 const arm::pipe::ProfilingGuid guid)
73 void Print(std::ostream& outStream)
const;
79 using DescPtr = std::unique_ptr<ProfilingDetails>;
94 template<
typename EventIterType>
98 void PopulateParent(std::vector<const Event*>& outEvents,
int& outBaseLevel, std::string parentName)
const;
135 template<
typename... Args>
138 const std::string& name,
145 std::vector<InstrumentPtr> instruments(0);
146 instruments.reserve(
sizeof...(args));
147 ConstructNextInVector(instruments, std::forward<Args>(args)...);
148 m_Event = m_Profiler->BeginEvent(backendId, name, std::move(instruments), guid);
154 if (m_Profiler && m_Event)
156 m_Profiler->pProfilerImpl->EndEvent(m_Event);
162 void ConstructNextInVector(std::vector<InstrumentPtr>& instruments)
167 template<
typename Arg,
typename... Args>
168 void ConstructNextInVector(std::vector<InstrumentPtr>& instruments, Arg&& arg, Args&&... args)
170 instruments.emplace_back(std::make_unique<Arg>(std::forward<Arg>(arg)));
171 ConstructNextInVector(instruments, std::forward<Args>(args)...);
175 IProfiler* m_Profiler;
179 template<
typename DescriptorType>
181 const DescriptorType& desc,
183 const arm::pipe::ProfilingGuid guid)
188 profiler->AddLayerDetails(name, desc, infos, guid);
192 template<
typename DescriptorType>
193 void IProfiler::AddLayerDetails(
const std::string& name,
194 const DescriptorType& desc,
196 const arm::pipe::ProfilingGuid guid)
198 return pProfilerImpl->AddLayerDetails(name, desc, infos, guid);
204 #define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, guid, ...) \
205 armnn::ScopedProfilingEvent e_ ## lineNumber(backendId, guid, __VA_ARGS__);
207 #define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(lineNumber, backendId, guid, ...) \
208 ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, guid, __VA_ARGS__)
217 #define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, guid, ...) \
218 ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(__LINE__,backendId, guid, __VA_ARGS__)
220 #define ARMNN_SCOPED_PROFILING_EVENT(backendId, name) \
221 ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, armnn::EmptyOptional(), name, armnn::WallClockTimer())
223 #define ARMNN_SCOPED_PROFILING_EVENT_GUID(backendId, name, guid) \
224 ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, guid, name, armnn::WallClockTimer())
227 #define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid) \
228 armnn::ProfilingUpdateDescriptions(name, desc, infos, guid);
Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Ev...
bool IsProfilingEnabled()
Checks whether profiling is enabled.
void AddLayerDetails(const std::string &label, const DescriptorType &desc, const WorkloadInfo &infos, const arm::pipe::ProfilingGuid guid)
void Print(std::ostream &outStream) const
std::map< std::string, ProfilingEventStats > CalculateProfilingEventStats() const
DescPtr m_ProfilingDetails
std::unique_ptr< Event > EventPtr
void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod)
std::unique_ptr< ProfilingDetails > DescPtr
std::vector< EventPtr > m_EventSequence
std::unique_ptr< Instrument > InstrumentPtr
std::stack< Event * > m_Parents
Event * BeginEvent(armnn::IProfiler *profiler, const BackendId &backendId, const std::string &name, std::vector< InstrumentPtr > &&instruments, const Optional< arm::pipe::ProfilingGuid > &guid)
void EndEvent(Event *event)
void PopulateParent(std::vector< const Event * > &outEvents, int &outBaseLevel, std::string parentName) const
bool IsProfilingEnabled()
uint32_t GetEventColor(const BackendId &backendId) const
void AnalyzeEventsAndWriteResults(std::ostream &outStream) const
void AnalyzeEventSequenceAndWriteResults(EventIterType first, EventIterType last, std::ostream &outStream) const
ProfilingDetailsMethod m_DetailsToStdOutMethod
void EnableProfiling(bool enableProfiling)
void PopulateDescendants(std::map< const Event *, std::vector< const Event * >> &outDescendantsMap) const
IProfiler * GetProfiler()
void RegisterProfiler(IProfiler *profiler)
static ProfilerManager & GetInstance()
std::unique_ptr< Instrument > InstrumentPtr
ScopedProfilingEvent(const BackendId &backendId, const Optional< arm::pipe::ProfilingGuid > &guid, const std::string &name, Args &&... args)
Copyright (c) 2021 ARM Limited and Contributors.
void ProfilingUpdateDescriptions(const std::string &name, const DescriptorType &desc, const WorkloadInfo &infos, const arm::pipe::ProfilingGuid guid)
void IgnoreUnused(Ts &&...)
ProfilingDetailsMethod
Define the behaviour of the internal profiler when outputting network details.
Contains information about TensorInfos of a layer.