1 // 2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 #include <cstdint> 9 #include <string> 10 11 namespace arm 12 { 13 14 namespace pipe 15 { 16 17 class ITimelineDecoder 18 { 19 20 public: 21 22 enum class TimelineStatus 23 { 24 TimelineStatus_Success, 25 TimelineStatus_Fail 26 }; 27 28 enum class RelationshipType 29 { 30 RetentionLink, /// Head retains(parents) Tail 31 ExecutionLink, /// Head execution start depends on Tail execution completion 32 DataLink, /// Head uses data of Tail 33 LabelLink /// Head uses label Tail (Tail MUST be a guid of a label). 34 }; 35 GetRelationshipAsCString(RelationshipType rType)36 static char const* GetRelationshipAsCString(RelationshipType rType) 37 { 38 switch (rType) 39 { 40 case RelationshipType::RetentionLink: return "RetentionLink"; 41 case RelationshipType::ExecutionLink: return "ExecutionLink"; 42 case RelationshipType::DataLink: return "DataLink"; 43 case RelationshipType::LabelLink: return "LabelLink"; 44 default: return "Unknown"; 45 } 46 } 47 48 struct Entity 49 { 50 uint64_t m_Guid; 51 }; 52 53 struct EventClass 54 { 55 uint64_t m_Guid; 56 uint64_t m_NameGuid; 57 }; 58 59 struct Event 60 { 61 uint64_t m_Guid; 62 uint64_t m_TimeStamp; 63 uint64_t m_ThreadId; 64 }; 65 66 struct Label 67 { 68 uint64_t m_Guid; 69 std::string m_Name; 70 }; 71 72 struct Relationship 73 { 74 RelationshipType m_RelationshipType; 75 uint64_t m_Guid; 76 uint64_t m_HeadGuid; 77 uint64_t m_TailGuid; 78 uint64_t m_AttributeGuid; 79 }; 80 81 virtual ~ITimelineDecoder() = default; 82 83 virtual TimelineStatus CreateEntity(const Entity&) = 0; 84 virtual TimelineStatus CreateEventClass(const EventClass&) = 0; 85 virtual TimelineStatus CreateEvent(const Event&) = 0; 86 virtual TimelineStatus CreateLabel(const Label&) = 0; 87 virtual TimelineStatus CreateRelationship(const Relationship&) = 0; 88 }; 89 90 } // namespace pipe 91 } // namespace arm 92