ArmNN
 21.02
TimelineModel Class Reference

#include <TimelineModel.hpp>

Public Member Functions

void AddLabel (const arm::pipe::ITimelineDecoder::Label &label)
 
std::string * FindLabel (uint64_t guid)
 
void AddEntity (uint64_t guid)
 
EntityFindEntity (uint64_t id)
 
void AddRelationship (const arm::pipe::ITimelineDecoder::Relationship &relationship)
 
ModelRelationshipFindRelationship (uint64_t id)
 
const LabelMapGetLabelMap () const
 
const EntitiesGetEntities () const
 
const std::vector< arm::pipe::ProfilingException > & GetErrors () const
 
bool IsInferenceGuid (uint64_t guid) const
 
void AddEventClass (const arm::pipe::ITimelineDecoder::EventClass &eventClass)
 
const EventClassesGetEventClasses () const
 
EventClassObjFindEventClass (uint64_t id)
 
void AddEvent (const arm::pipe::ITimelineDecoder::Event &event)
 
EventObjFindEvent (uint64_t id)
 

Detailed Description

Definition at line 146 of file TimelineModel.hpp.

Member Function Documentation

◆ AddEntity()

void AddEntity ( uint64_t  guid)

Definition at line 35 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateEntity().

36 {
37  m_Entities.emplace(guid, guid);
38 }

◆ AddEvent()

void AddEvent ( const arm::pipe::ITimelineDecoder::Event &  event)

Definition at line 310 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateEvent().

311 {
312  EventObj evt(event.m_Guid, event.m_TimeStamp, event.m_ThreadId);
313  m_Events.emplace(event.m_Guid, evt);
314 }

◆ AddEventClass()

void AddEventClass ( const arm::pipe::ITimelineDecoder::EventClass &  eventClass)

Definition at line 280 of file TimelineModel.cpp.

References TimelineModel::FindLabel(), and EventClassObj::GetGuid().

Referenced by TimelineMessageDecoder::CreateEventClass().

281 {
282  std::string* eventClassName = FindLabel(eventClass.m_NameGuid);
283  if (eventClassName != nullptr)
284  {
285  EventClassObj eventClassObj(eventClass.m_Guid, *eventClassName);
286  m_EventClasses.emplace(eventClassObj.GetGuid(), eventClassObj);
287  }
288  else
289  {
290  std::stringstream ss;
291  ss << "could not find name [" << eventClass.m_NameGuid << "]";
292  ss << " of of event class [" << eventClass.m_Guid << "]";
293  m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
294  }
295 }
std::string * FindLabel(uint64_t guid)

◆ AddLabel()

void AddLabel ( const arm::pipe::ITimelineDecoder::Label &  label)

Definition at line 17 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateLabel().

18 {
19  m_LabelMap.emplace(label.m_Guid, label);
20 }

◆ AddRelationship()

void AddRelationship ( const arm::pipe::ITimelineDecoder::Relationship &  relationship)

Definition at line 53 of file TimelineModel.cpp.

References Entity::AddAttribute(), Entity::AddChild(), Entity::AddConnection(), Entity::AddEvent(), Entity::AddExecution(), LabelsAndEventClasses::CHILD_GUID, LabelsAndEventClasses::CONNECTION_GUID, LabelsAndEventClasses::EXECUTION_OF_GUID, TimelineModel::FindEntity(), TimelineModel::FindEvent(), TimelineModel::FindEventClass(), TimelineModel::FindLabel(), LabelsAndEventClasses::INFERENCE, EventObj::SetEventClass(), and LabelsAndEventClasses::TYPE_LABEL.

Referenced by TimelineMessageDecoder::CreateRelationship().

54 {
55  m_Relationships.emplace(relationship.m_Guid, relationship);
56  if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::LabelLink)
57  {
58  HandleLabelLink(relationship);
59  }
60  else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink)
61  {
62  // Take care of the special case of a connection between layers in ArmNN
63  // modelled by a retention link between two layer entities with an attribute GUID
64  // of connection
65  if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CONNECTION_GUID)
66  {
67  HandleConnection(relationship);
68  }
69  else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CHILD_GUID)
70  {
71  HandleChild(relationship);
72  }
73  else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::EXECUTION_OF_GUID)
74  {
75  HandleExecutionOf(relationship);
76  }
77  else
78  {
79  // report unknown relationship type
80  std::stringstream ss;
81  ss << "Encountered a RetentionLink of unknown type [" << relationship.m_AttributeGuid << "]";
82  m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
83  }
84  }
85  else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink)
86  {
87  HandleExecutionLink(relationship);
88  }
89 }
static ARMNN_DLLEXPORT ProfilingStaticGuid CONNECTION_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid EXECUTION_OF_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid CHILD_GUID

◆ FindEntity()

Entity * FindEntity ( uint64_t  id)

Definition at line 40 of file TimelineModel.cpp.

Referenced by TimelineModel::AddRelationship().

41 {
42  auto iter = m_Entities.find(id);
43  if (iter != m_Entities.end())
44  {
45  return &(iter->second);
46  }
47  else
48  {
49  return nullptr;
50  }
51 }

◆ FindEvent()

EventObj * FindEvent ( uint64_t  id)

Definition at line 316 of file TimelineModel.cpp.

Referenced by TimelineModel::AddRelationship().

317 {
318  auto iter = m_Events.find(id);
319  if (iter != m_Events.end())
320  {
321  return &(iter->second);
322  }
323  else
324  {
325  return nullptr;
326  }
327 }

◆ FindEventClass()

EventClassObj * FindEventClass ( uint64_t  id)

Definition at line 297 of file TimelineModel.cpp.

Referenced by TimelineModel::AddRelationship().

298 {
299  auto iter = m_EventClasses.find(id);
300  if (iter != m_EventClasses.end())
301  {
302  return &(iter->second);
303  }
304  else
305  {
306  return nullptr;
307  }
308 }

◆ FindLabel()

std::string * FindLabel ( uint64_t  guid)

Definition at line 22 of file TimelineModel.cpp.

Referenced by TimelineModel::AddEventClass(), and TimelineModel::AddRelationship().

23 {
24  auto iter = m_LabelMap.find(guid);
25  if (iter != m_LabelMap.end())
26  {
27  return &iter->second.m_Name;
28  }
29  else
30  {
31  return nullptr;
32  }
33 }

◆ FindRelationship()

ModelRelationship * FindRelationship ( uint64_t  id)

Definition at line 261 of file TimelineModel.cpp.

262 {
263  auto iter = m_Relationships.find(id);
264  if (iter != m_Relationships.end())
265  {
266  return &(iter->second);
267  }
268  else
269  {
270  return nullptr;
271  }
272 }

◆ GetEntities()

const Entities& GetEntities ( ) const
inline

Definition at line 156 of file TimelineModel.hpp.

Referenced by armnn::profiling::GetModelDescription().

156 {return m_Entities;}

◆ GetErrors()

const std::vector<arm::pipe::ProfilingException>& GetErrors ( ) const
inline

Definition at line 157 of file TimelineModel.hpp.

Referenced by BOOST_AUTO_TEST_CASE().

157 {return m_Errors;}

◆ GetEventClasses()

◆ GetLabelMap()

const LabelMap& GetLabelMap ( ) const
inline

Definition at line 155 of file TimelineModel.hpp.

155 {return m_LabelMap;}

◆ IsInferenceGuid()

bool IsInferenceGuid ( uint64_t  guid) const

Definition at line 274 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateRelationship().

275 {
276  auto it = std::find(m_InferenceGuids.begin(), m_InferenceGuids.end(), guid);
277  return it != m_InferenceGuids.end();
278 }

The documentation for this class was generated from the following files: