ArmNN
 22.08
Profiling.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #include "Profiling.hpp"
6 
7 #include <armnn/BackendId.hpp>
9 
10 #include "JsonPrinter.hpp"
11 
12 #if ARMNN_STREAMLINE_ENABLED
13 #include <streamline_annotate.h>
14 #endif
15 
16 #include <algorithm>
17 #include <iomanip>
18 #include <iostream>
19 #include <fstream>
20 #include <map>
21 #include <stack>
22 
23 namespace armnn
24 {
25 
26 // Controls the amount of memory initially allocated to store profiling events.
27 // If chosen carefully, the profiling system will not make any additional allocations, thus minimizing its impact on
28 // measured times.
29 constexpr std::size_t g_ProfilingEventCountHint = 1024;
30 
31 // Whether profiling reports should include the sequence of events together with their timings.
32 constexpr bool g_WriteProfilingEventSequence = true;
33 
34 // Whether profiling reports should also report detailed information on events grouped by inference.
35 // This can spam the output stream, so use carefully (or adapt the code to just output information
36 // of interest).
38 
39 // Whether a call to Profiler::AnalyzeEventsAndWriteResults() will be made when the Profiler is destroyed.
40 // It can be convenient for local tests.
42 
43 Measurement FindMeasurement(const std::string& name, const Event* event)
44 {
45 
46  ARMNN_ASSERT(event != nullptr);
47 
48  // Search though the measurements.
49  for (const auto& measurement : event->GetMeasurements())
50  {
51  if (measurement.m_Name == name)
52  {
53  // Measurement found.
54  return measurement;
55  }
56  }
57 
58  // Measurement not found.
59  return Measurement{ "", 0.f, Measurement::Unit::TIME_MS };
60 }
61 
62 std::vector<Measurement> FindKernelMeasurements(const Event* event)
63 {
64  ARMNN_ASSERT(event != nullptr);
65 
66  std::vector<Measurement> measurements;
67 
68  // Search through the measurements.
69  for (const auto& measurement : event->GetMeasurements())
70  {
71  if (measurement.m_Name.rfind("OpenClKernelTimer", 0) == 0
72  || measurement.m_Name.rfind("NeonKernelTimer", 0) == 0)
73  {
74  // Measurement found.
75  measurements.push_back(measurement);
76  }
77  }
78 
79  return measurements;
80 }
81 
82 std::map<std::string, ProfilerImpl::ProfilingEventStats> ProfilerImpl::CalculateProfilingEventStats() const
83 {
84  std::map<std::string, ProfilingEventStats> nameToStatsMap;
85 
86  for (const auto& event : m_EventSequence)
87  {
89 
90  double durationMs = measurement.m_Value;
91  auto it = nameToStatsMap.find(event->GetName());
92  if (it != nameToStatsMap.end())
93  {
94  ProfilingEventStats& stats = it->second;
95  stats.m_TotalMs += durationMs;
96  stats.m_MinMs = std::min(stats.m_MinMs, durationMs);
97  stats.m_MaxMs = std::max(stats.m_MaxMs, durationMs);
98  ++stats.m_Count;
99  }
100  else
101  {
102  nameToStatsMap.emplace(event->GetName(), ProfilingEventStats{ durationMs, durationMs, durationMs, 1 });
103  }
104  }
105 
106  return nameToStatsMap;
107 }
108 
109 const Event* GetEventPtr(const Event* ptr) { return ptr;}
110 const Event* GetEventPtr(const std::unique_ptr<Event>& ptr) {return ptr.get(); }
111 
112 template<typename ItertType>
113 void ProfilerImpl::AnalyzeEventSequenceAndWriteResults(ItertType first, ItertType last, std::ostream& outStream) const
114 {
115  // Outputs event sequence, if needed.
116  if (g_WriteProfilingEventSequence)
117  {
118  // Makes sure timestamps are output with 6 decimals, and save old settings.
119  std::streamsize oldPrecision = outStream.precision();
120  outStream.precision(6);
121  std::ios_base::fmtflags oldFlags = outStream.flags();
122  outStream.setf(std::ios::fixed);
123  // Outputs fields.
124  outStream << "Event Sequence - Name | Duration (ms) | Start (ms) | Stop (ms) | Device" << std::endl;
125  for (auto event = first; event != last; ++event)
126  {
127  const Event* eventPtr = GetEventPtr((*event));
128  double startTimeMs = FindMeasurement(WallClockTimer::WALL_CLOCK_TIME_START, eventPtr).m_Value;
129  double stopTimeMs = FindMeasurement(WallClockTimer::WALL_CLOCK_TIME_STOP, eventPtr).m_Value;
130 
131  // Find the WallClock measurement if there is one.
132  double durationMs = FindMeasurement(WallClockTimer::WALL_CLOCK_TIME, eventPtr).m_Value;
133  outStream << std::setw(50) << eventPtr->GetName() << " "
134  << std::setw(20) << durationMs
135  << std::setw(20) << startTimeMs
136  << std::setw(20) << stopTimeMs
137  << std::setw(20) << eventPtr->GetBackendId().Get()
138  << std::endl;
139  }
140  outStream << std::endl;
141  // Restores previous precision settings.
142  outStream.flags(oldFlags);
143  outStream.precision(oldPrecision);
144  }
145 
146  // Aggregates results per event name.
147  std::map<std::string, ProfilingEventStats> nameToStatsMap = CalculateProfilingEventStats();
148 
149  // Outputs aggregated stats.
150  outStream << "Event Stats - Name | Avg (ms) | Min (ms) | Max (ms) | Total (ms) | Count" << std::endl;
151  for (const auto& pair : nameToStatsMap)
152  {
153  const std::string& eventLabel = pair.first;
154  const ProfilingEventStats& eventStats = pair.second;
155  const double avgMs = eventStats.m_TotalMs / double(eventStats.m_Count);
156 
157  outStream << "\t" << std::setw(50) << eventLabel << " " << std::setw(9) << avgMs << " "
158  << std::setw(9) << eventStats.m_MinMs << " " << std::setw(9) << eventStats.m_MaxMs << " "
159  << std::setw(9) << eventStats.m_TotalMs << " " << std::setw(9) << eventStats.m_Count << std::endl;
160  }
161  outStream << std::endl;
162 }
163 
165  : m_ProfilingEnabled(false),
167 {
168  m_EventSequence.reserve(g_ProfilingEventCountHint);
169 
170 #if ARMNN_STREAMLINE_ENABLED
171  // Initialises streamline annotations.
172  ANNOTATE_SETUP;
173 #endif
174 }
175 
177 {
178  if (m_ProfilingEnabled)
179  {
180  if (g_WriteReportToStdOutOnProfilerDestruction)
181  {
182  Print(std::cout);
183  }
184  }
185 
186  // Un-register this profiler from the current thread.
188 }
189 
191 {
192  return m_ProfilingEnabled;
193 }
194 
195 void ProfilerImpl::EnableProfiling(bool enableProfiling)
196 {
197  m_ProfilingEnabled = enableProfiling;
198 }
199 
201 {
202  m_DetailsToStdOutMethod = details;
203 }
204 
206  const BackendId& backendId,
207  const std::string& label,
208  std::vector<InstrumentPtr>&& instruments,
210 {
211  Event* parent = m_Parents.empty() ? nullptr : m_Parents.top();
212  m_EventSequence.push_back(std::make_unique<Event>(label,
213  profiler,
214  parent,
215  backendId,
216  std::move(instruments),
217  guid));
218  Event* event = m_EventSequence.back().get();
219  event->Start();
220 
221 #if ARMNN_STREAMLINE_ENABLED
222  ANNOTATE_CHANNEL_COLOR(uint32_t(m_Parents.size()), GetEventColor(backendId), label.c_str());
223 #endif
224 
225  m_Parents.push(event);
226  return event;
227 }
228 
230 {
231  event->Stop();
232 
233  ARMNN_ASSERT(!m_Parents.empty());
234  ARMNN_ASSERT(event == m_Parents.top());
235  m_Parents.pop();
236 
237  Event* parent = m_Parents.empty() ? nullptr : m_Parents.top();
238  IgnoreUnused(parent);
239  ARMNN_ASSERT(event->GetParentEvent() == parent);
240 
241 #if ARMNN_STREAMLINE_ENABLED
242  ANNOTATE_CHANNEL_END(uint32_t(m_Parents.size()));
243 #endif
244 }
245 
246 int CalcLevel(const Event* eventPtr)
247 {
248  int level = 0;
249  while (eventPtr != nullptr)
250  {
251  eventPtr = eventPtr->GetParentEvent();
252  level++;
253  }
254  return level;
255 }
256 
257 void ProfilerImpl::PopulateParent(std::vector<const Event*>& outEvents, int& outBaseLevel, std::string parentName) const
258 {
259  outEvents.reserve(m_EventSequence.size());
260  for (const auto& event : m_EventSequence)
261  {
262  const Event* eventPtrRaw = event.get();
263  if (eventPtrRaw->GetName() == parentName)
264  {
265  outBaseLevel = (outBaseLevel == -1) ? CalcLevel(eventPtrRaw) : outBaseLevel;
266  outEvents.push_back(eventPtrRaw);
267  }
268  }
269 }
270 
271 void ProfilerImpl::PopulateDescendants(std::map<const Event*, std::vector<const Event*>>& outDescendantsMap) const
272 {
273  for (const auto& event : m_EventSequence)
274  {
275  const Event* eventPtrRaw = event.get();
276  const Event* parent = eventPtrRaw->GetParentEvent();
277 
278  if (!parent)
279  {
280  continue;
281  }
282 
283  auto it = outDescendantsMap.find(parent);
284  if (it == outDescendantsMap.end())
285  {
286  outDescendantsMap.emplace(parent, std::vector<const Event*>({ eventPtrRaw }));
287  }
288  else
289  {
290  it->second.push_back(eventPtrRaw);
291  }
292  }
293 }
294 
296  std::string layerDetailsStr)
297 {
299  detailsObject.SetAndParseDetails(layerDetailsStr);
300 
301 }
302 
303 void ExtractJsonObjects(unsigned int inferenceIndex,
304  const Event* parentEvent,
305  JsonChildObject& parentObject,
306  std::map<const Event*, std::vector<const Event*>> descendantsMap)
307 {
308  ARMNN_ASSERT(parentEvent);
309 
310  // If profiling GUID is entered, process it
311  if (parentEvent->GetProfilingGuid().has_value())
312  {
313  arm::pipe::ProfilingGuid profilingGuid;
314  profilingGuid = parentEvent->GetProfilingGuid().value();
315  parentObject.SetGuid(profilingGuid);
316  }
317  std::vector<Measurement> instrumentMeasurements = parentEvent->GetMeasurements();
318  unsigned int childIdx = 0;
319  for (size_t measurementIndex = 0; measurementIndex < instrumentMeasurements.size(); ++measurementIndex, ++childIdx)
320  {
321  if (inferenceIndex == 0)
322  {
323  // Only add kernel measurement once, in case of multiple inferences
324  JsonChildObject measurementObject{ instrumentMeasurements[measurementIndex].m_Name };
325  measurementObject.SetUnit(instrumentMeasurements[measurementIndex].m_Unit);
326  measurementObject.SetType(JsonObjectType::Measurement);
327 
328  ARMNN_ASSERT(parentObject.NumChildren() == childIdx);
329  parentObject.AddChild(measurementObject);
330  }
331 
332  parentObject.GetChild(childIdx).AddMeasurement(instrumentMeasurements[measurementIndex].m_Value);
333  }
334 
335  auto childEventsIt = descendantsMap.find(parentEvent);
336  if (childEventsIt != descendantsMap.end())
337  {
338  for (auto childEvent : childEventsIt->second)
339  {
340  if (inferenceIndex == 0)
341  {
342  // Only add second level once, in case of multiple inferences
343  JsonChildObject childObject{ childEvent->GetName() };
344  childObject.SetType(JsonObjectType::Event);
345  parentObject.AddChild(childObject);
346  }
347 
348  // It's possible that childIdx can overrun the parents' child vector. Check before we try to process a
349  // non-existent child.
350  if (childIdx < parentObject.NumChildren())
351  {
352  // Recursively process children.
353  ExtractJsonObjects(inferenceIndex, childEvent, parentObject.GetChild(childIdx), descendantsMap);
354  childIdx++;
355  }
356  }
357  }
358 }
359 
360 void ProfilerImpl::Print(std::ostream& outStream) const
361 {
362  // Makes sure timestamps are output with 6 decimals, and save old settings.
363  std::streamsize oldPrecision = outStream.precision();
364  outStream.precision(6);
365  std::ios_base::fmtflags oldFlags = outStream.flags();
366  outStream.setf(std::ios::fixed);
367  JsonPrinter printer(outStream);
368 
369  // First find all the parent Events and print out duration measurements.
370  int baseLevel = -1;
371 
372  std::vector<const Event*> optimizations;
373  PopulateParent(optimizations, baseLevel, "Optimizer");
374 
375  std::vector<const Event*> loadedNetworks;
376  PopulateParent(loadedNetworks, baseLevel, "LoadedNetwork");
377 
378  std::vector<const Event*> inferences;
379  PopulateParent(inferences, baseLevel, "EnqueueWorkload");
380 
381  // Second map out descendants hierarchy
382  std::map<const Event*, std::vector<const Event*>> descendantsMap;
383  PopulateDescendants(descendantsMap);
384 
385  // Extract json objects for each parent event type
386  JsonChildObject optimizeObject{ "optimize_measurements" };
387 
388  for (unsigned int optimizeIndex = 0; optimizeIndex < optimizations.size(); ++optimizeIndex)
389  {
390  auto optimization = optimizations[optimizeIndex];
391  ExtractJsonObjects(optimizeIndex, optimization, optimizeObject, descendantsMap);
392  }
393 
394  JsonChildObject loadedNetworkObject{ "loaded_network_measurements" };
395 
396  for (unsigned int loadedNetworkIndex = 0; loadedNetworkIndex < loadedNetworks.size(); ++loadedNetworkIndex)
397  {
398  auto loadedNetwork = loadedNetworks[loadedNetworkIndex];
399  ExtractJsonObjects(loadedNetworkIndex, loadedNetwork, loadedNetworkObject, descendantsMap);
400  }
401 
402  JsonChildObject inferenceObject{ "inference_measurements" };
403 
404  for (unsigned int inferenceIndex = 0; inferenceIndex < inferences.size(); ++inferenceIndex)
405  {
406  auto inference = inferences[inferenceIndex];
407  ExtractJsonObjects(inferenceIndex, inference, inferenceObject, descendantsMap);
408  }
409 
410  printer.PrintHeader();
411  printer.PrintArmNNHeader();
412 
413  if (m_ProfilingDetails.get()->DetailsExist() &&
416  {
417  JsonChildObject detailsObject{ "layer_details" };
419  {
420  detailsObject.EnableDetailsOnly();
421  }
422  detailsObject.SetType(JsonObjectType::ExecObjectDesc);
423  detailsObject.SetAndParseDetails(m_ProfilingDetails.get()->GetProfilingDetails());
424 
425  size_t id = 0;
426  printer.PrintJsonChildObject(detailsObject, id);
427  }
428 
429  // print inference object, also prints child layer and kernel measurements
430  size_t id = 0;
432  {
433  printer.PrintJsonChildObject(optimizeObject, id);
434  printer.PrintSeparator();
435  printer.PrintNewLine();
436  printer.PrintJsonChildObject(loadedNetworkObject, id);
437  printer.PrintSeparator();
438  printer.PrintNewLine();
439  printer.PrintJsonChildObject(inferenceObject, id);
440  printer.PrintNewLine();
441  }
442  // end of ArmNN
443  printer.PrintFooter();
444 
445  // end of main JSON object
446  printer.PrintNewLine();
447  printer.PrintFooter();
448  printer.PrintNewLine();
449 
450  // Restores previous precision settings.
451  outStream.flags(oldFlags);
452  outStream.precision(oldPrecision);
453 
455  {
456  exit(0);
457  }
458 }
459 
460 void ProfilerImpl::AnalyzeEventsAndWriteResults(std::ostream& outStream) const
461 {
462  // Stack should be empty now.
463  const bool saneMarkerSequence = m_Parents.empty();
464 
465  // Abort if the sequence of markers was found to have incorrect information:
466  // The stats cannot be trusted.
467  if (!saneMarkerSequence)
468  {
469  outStream << "Cannot write profiling stats. "
470  "Unexpected errors were found when analyzing the sequence of logged events, "
471  "which may lead to plainly wrong stats. The profiling system may contain implementation "
472  "issues or could have been used in an unsafe manner." << std::endl;
473  return;
474  }
475 
476  // Analyzes the full sequence of events.
478  m_EventSequence.cend(),
479  outStream);
480 
481  // Aggregates events by tag if requested (spams the output stream if done for all tags).
482  if (g_AggregateProfilingEventsByInference)
483  {
484  outStream << std::endl;
485  outStream << "***" << std::endl;
486  outStream << "*** Per Inference Stats" << std::endl;
487  outStream << "***" << std::endl;
488  outStream << std::endl;
489 
490  int baseLevel = -1;
491  std::vector<const Event*> inferences;
492  PopulateParent(inferences, baseLevel, "EnqueueWorkload");
493 
494  // Second map out descendants hierarchy
495  std::map<const Event*, std::vector<const Event*>> descendantsMap;
496  PopulateDescendants(descendantsMap);
497 
498  std::function<void(const Event*, std::vector<const Event*>&)>
499  FindDescendantEvents = [&](const Event* eventPtr, std::vector<const Event*>& sequence)
500  {
501  sequence.push_back(eventPtr);
502 
503  if (CalcLevel(eventPtr) > baseLevel+2) //We only care about levels as deep as workload executions.
504  {
505  return;
506  }
507 
508  auto children = descendantsMap.find(eventPtr);
509  if (children == descendantsMap.end())
510  {
511  return;
512  }
513 
514  if (!(children->second.empty()))
515  {
516  return FindDescendantEvents(children->second[0], sequence);
517  }
518  };
519 
520  // Third, find events belonging to each inference
521  int inferenceIdx = 0;
522  for (auto inference : inferences)
523  {
524  std::vector<const Event*> sequence;
525 
526  //build sequence, depth first
527  FindDescendantEvents(inference, sequence);
528 
529  outStream << "> Begin Inference: " << inferenceIdx << std::endl;
530  outStream << std::endl;
531  AnalyzeEventSequenceAndWriteResults(sequence.cbegin(),
532  sequence.cend(),
533  outStream);
534  outStream << std::endl;
535  outStream << "> End Inference: " << inferenceIdx << std::endl;
536 
537  inferenceIdx++;
538  }
539  }
540 }
541 
542 std::uint32_t ProfilerImpl::GetEventColor(const BackendId& backendId) const
543 {
544  static BackendId cpuRef("CpuRef");
545  static BackendId cpuAcc("CpuAcc");
546  static BackendId gpuAcc("GpuAcc");
547  if (backendId == cpuRef)
548  {
549  // Cyan
550  return 0xffff001b;
551  }
552  else if (backendId == cpuAcc)
553  {
554  // Green
555  return 0x00ff001b;
556  }
557  else if (backendId == gpuAcc)
558  {
559  // Purple
560  return 0xff007f1b;
561  }
562  else
563  {
564  // Dark gray
565  return 0x5555551b;
566  }
567 }
568 
569 // The thread_local pointer to the profiler instance.
570 thread_local IProfiler* tl_Profiler = nullptr;
571 
573 {
574  // Global reference to the single ProfileManager instance allowed.
575  static ProfilerManager s_ProfilerManager;
576  return s_ProfilerManager;
577 }
578 
580 {
581  tl_Profiler = profiler;
582 }
583 
585 {
586  return tl_Profiler;
587 }
588 
589 void IProfiler::EnableProfiling(bool enableProfiling)
590 {
591  pProfilerImpl->EnableProfiling(enableProfiling);
592 }
593 
595 {
596  pProfilerImpl->EnableNetworkDetailsToStdOut(detailsMethod);
597 }
598 
600 {
601  return pProfilerImpl->IsProfilingEnabled();
602 }
603 
604 void IProfiler::AnalyzeEventsAndWriteResults(std::ostream& outStream) const
605 {
606  pProfilerImpl->AnalyzeEventsAndWriteResults(outStream);
607 }
608 
609 void IProfiler::Print(std::ostream& outStream) const
610 {
611  pProfilerImpl->Print(outStream);
612 }
613 
614 Event* IProfiler::BeginEvent(const BackendId& backendId,
615  const std::string& label,
616  std::vector<InstrumentPtr>&& instruments,
618 {
619  return pProfilerImpl->BeginEvent(this, backendId, label, std::move(instruments), guid);
620 }
621 
622 IProfiler::~IProfiler() = default;
623 IProfiler::IProfiler() : pProfilerImpl(new ProfilerImpl())
624 {};
625 
626 } // namespace armnn
JsonChildObject & GetChild(const unsigned int index)
Definition: JsonPrinter.hpp:64
Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Ev...
const Event * GetEventPtr(const Event *ptr)
Definition: Profiling.cpp:109
constexpr bool g_WriteReportToStdOutOnProfilerDestruction
Definition: Profiling.cpp:41
void AddChild(const JsonChildObject &childObject)
Definition: JsonPrinter.hpp:59
void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod)
Definition: Profiling.cpp:200
int CalcLevel(const Event *eventPtr)
Definition: Profiling.cpp:246
static ProfilerManager & GetInstance()
Definition: Profiling.cpp:572
Measurement FindMeasurement(const std::string &name, const Event *event)
Definition: Profiling.cpp:43
void PrintHeader()
Definition: JsonUtils.hpp:58
uint32_t GetEventColor(const BackendId &backendId) const
Definition: Profiling.cpp:542
std::vector< Measurement > FindKernelMeasurements(const Event *event)
Definition: Profiling.cpp:62
void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod)
Print out details of each layer within the network that possesses a descriptor.
Definition: Profiling.cpp:594
void Print(std::ostream &outStream) const
Print stats for events in JSON Format to the given output stream.
Definition: Profiling.cpp:609
std::map< std::string, ProfilingEventStats > CalculateProfilingEventStats() const
Definition: Profiling.cpp:82
void AnalyzeEventsAndWriteResults(std::ostream &outStream) const
Analyzes the tracked events and writes the results to the given output stream.
Definition: Profiling.cpp:604
const std::string & GetName() const
Get the name of the event.
Copyright (c) 2021 ARM Limited and Contributors.
void IgnoreUnused(Ts &&...)
void PrintArmNNHeader()
Definition: JsonUtils.hpp:64
Optional< arm::pipe::ProfilingGuid > GetProfilingGuid() const
Get the associated profiling GUID if the event is a workload.
void AnalyzeEventSequenceAndWriteResults(EventIterType first, EventIterType last, std::ostream &outStream) const
ProfilingDetailsMethod
Define the behaviour of the internal profiler when outputting network details.
Definition: Types.hpp:71
void SetAndParseDetails(std::string layerDetailsStr)
Definition: JsonPrinter.hpp:44
size_t NumChildren() const
Definition: JsonPrinter.hpp:74
IProfiler * GetProfiler()
Definition: Profiling.cpp:584
void ConfigureDetailsObject(JsonChildObject &detailsObject, std::string layerDetailsStr)
Definition: Profiling.cpp:295
BackendId GetBackendId() const
Get the backend id of the event.
void AnalyzeEventsAndWriteResults(std::ostream &outStream) const
Definition: Profiling.cpp:460
const std::vector< Measurement > GetMeasurements() const
Get the recorded measurements calculated between Start() and Stop()
void ExtractJsonObjects(unsigned int inferenceIndex, const Event *parentEvent, JsonChildObject &parentObject, std::map< const Event *, std::vector< const Event *>> descendantsMap)
Definition: Profiling.cpp:303
void PrintFooter()
Definition: JsonUtils.hpp:51
void EnableProfiling(bool enableProfiling)
Enables/disables profiling for this profiler.
Definition: Profiling.cpp:589
static const std::string WALL_CLOCK_TIME_STOP
void SetType(JsonObjectType type)
Definition: JsonPrinter.hpp:79
static const std::string WALL_CLOCK_TIME_START
constexpr std::size_t g_ProfilingEventCountHint
Definition: Profiling.cpp:29
bool has_value() const noexcept
Definition: Optional.hpp:53
Event * BeginEvent(armnn::IProfiler *profiler, const BackendId &backendId, const std::string &name, std::vector< InstrumentPtr > &&instruments, const Optional< arm::pipe::ProfilingGuid > &guid)
Definition: Profiling.cpp:205
static const std::string WALL_CLOCK_TIME
bool IsProfilingEnabled()
Checks whether profiling is enabled.
Definition: Profiling.cpp:599
void AddMeasurement(const double measurement)
Definition: JsonPrinter.hpp:39
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
void PopulateParent(std::vector< const Event *> &outEvents, int &outBaseLevel, std::string parentName) const
Definition: Profiling.cpp:257
void EndEvent(Event *event)
Definition: Profiling.cpp:229
void PrintJsonChildObject(const JsonChildObject &object, size_t &id)
Definition: JsonPrinter.cpp:15
constexpr bool g_WriteProfilingEventSequence
Definition: Profiling.cpp:32
constexpr bool g_AggregateProfilingEventsByInference
Definition: Profiling.cpp:37
void PrintNewLine()
Definition: JsonUtils.hpp:46
ProfilingDetailsMethod m_DetailsToStdOutMethod
Definition: Profiling.hpp:105
void Print(std::ostream &outStream) const
Definition: Profiling.cpp:360
void PrintSeparator()
Definition: JsonUtils.hpp:70
void SetGuid(arm::pipe::ProfilingGuid guid)
Definition: JsonPrinter.hpp:54
void RegisterProfiler(IProfiler *profiler)
Definition: Profiling.cpp:579
DescPtr m_ProfilingDetails
Definition: Profiling.hpp:103
const std::string & Get() const
Definition: BackendId.hpp:138
void SetUnit(const Measurement::Unit unit)
Definition: JsonPrinter.hpp:69
std::stack< Event * > m_Parents
Definition: Profiling.hpp:101
const Event * GetParentEvent() const
Get the pointer of the parent event.
thread_local IProfiler * tl_Profiler
Definition: Profiling.cpp:570
void PopulateDescendants(std::map< const Event *, std::vector< const Event *>> &outDescendantsMap) const
Definition: Profiling.cpp:271
std::vector< EventPtr > m_EventSequence
Definition: Profiling.hpp:102
void EnableProfiling(bool enableProfiling)
Definition: Profiling.cpp:195