aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/profiling/ITimelineDecoder.hpp
blob: 0035a3b7d229309b7a4532aee9c526029078c3c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Copyright © 2020 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <cstdint>
#include <string>

class ITimelineDecoder
{

public:

    enum class TimelineStatus
    {
        TimelineStatus_Success,
        TimelineStatus_Fail
    };

    enum class RelationshipType
    {
        RetentionLink, /// Head retains(parents) Tail
        ExecutionLink, /// Head execution start depends on Tail execution completion
        DataLink,      /// Head uses data of Tail
        LabelLink      /// Head uses label Tail (Tail MUST be a guid of a label).
    };

    static char const* GetRelationshipAsCString(RelationshipType rType)
    {
        switch (rType)
        {
            case RelationshipType::RetentionLink: return "RetentionLink";
            case RelationshipType::ExecutionLink: return "ExecutionLink";
            case RelationshipType::DataLink: return "DataLink";
            case RelationshipType::LabelLink: return "LabelLink";
            default: return "Unknown";
        }
    }

    struct Entity
    {
        uint64_t m_Guid;
    };

    struct EventClass
    {
        uint64_t m_Guid;
        uint64_t m_NameGuid;
    };

    struct Event
    {
        uint64_t m_Guid;
        uint64_t m_TimeStamp;
        uint64_t m_ThreadId;
    };

    struct Label
    {
        uint64_t m_Guid;
        std::string m_Name;
    };

    struct Relationship
    {
        RelationshipType m_RelationshipType;
        uint64_t m_Guid;
        uint64_t m_HeadGuid;
        uint64_t m_TailGuid;
        uint64_t m_AttributeGuid;
    };

    virtual ~ITimelineDecoder() = default;

    virtual TimelineStatus CreateEntity(const Entity&) = 0;
    virtual TimelineStatus CreateEventClass(const EventClass&) = 0;
    virtual TimelineStatus CreateEvent(const Event&) = 0;
    virtual TimelineStatus CreateLabel(const Label&) = 0;
    virtual TimelineStatus CreateRelationship(const Relationship&) = 0;
};