ArmNN
 22.08
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 36 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateEntity().

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

◆ AddEvent()

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

Definition at line 311 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateEvent().

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

◆ AddEventClass()

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

Definition at line 281 of file TimelineModel.cpp.

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

Referenced by TimelineMessageDecoder::CreateEventClass().

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

◆ AddLabel()

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

Definition at line 18 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateLabel().

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

◆ AddRelationship()

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

Definition at line 54 of file TimelineModel.cpp.

References Entity::AddAttribute(), TimelineModel::FindEntity(), and TimelineModel::FindLabel().

Referenced by TimelineMessageDecoder::CreateRelationship().

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

◆ FindEntity()

Entity * FindEntity ( uint64_t  id)

Definition at line 41 of file TimelineModel.cpp.

Referenced by TimelineModel::AddRelationship().

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

◆ FindEvent()

EventObj * FindEvent ( uint64_t  id)

Definition at line 317 of file TimelineModel.cpp.

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

◆ FindEventClass()

EventClassObj * FindEventClass ( uint64_t  id)

Definition at line 298 of file TimelineModel.cpp.

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

◆ FindLabel()

std::string * FindLabel ( uint64_t  guid)

Definition at line 23 of file TimelineModel.cpp.

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

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

◆ FindRelationship()

ModelRelationship * FindRelationship ( uint64_t  id)

Definition at line 262 of file TimelineModel.cpp.

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

◆ GetEntities()

const Entities& GetEntities ( ) const
inline

Definition at line 156 of file TimelineModel.hpp.

Referenced by arm::pipe::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 TEST_SUITE().

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 275 of file TimelineModel.cpp.

Referenced by TimelineMessageDecoder::CreateRelationship().

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

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