aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test/TimelineModel.hpp
blob: 7b88d5fa2c149908934e347d38b25e8f57eda098 (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
//
// Copyright © 2020 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <armnn/profiling/ITimelineDecoder.hpp>

#include <map>
#include <vector>

namespace armnn
{

namespace profiling
{
using LabelMap = std::map<uint64_t, ITimelineDecoder::Label>;
using Attribute = std::pair<std::string, std::string>;
using Attributes = std::map<std::string, Attribute>;
class Entity
{
public:
    Entity(uint64_t guid) : m_Guid(guid) {}
    uint64_t GetGuid() {return m_Guid;}
    void AddChild(Entity* child)
    {
        if (child != nullptr)
        {
            m_Children.push_back(child);
        }
    }
    void AddAttribute(const std::string& type, const std::string& value)
    {
        Attribute attr(type, value);
        m_Attributes.emplace(type, attr);
    }
private:
    uint64_t m_Guid;
    Attributes m_Attributes;
    std::vector<Entity*> m_Children;
};
using Entities = std::map<uint64_t, Entity>;
struct ModelRelationship
{
    ModelRelationship(const ITimelineDecoder::Relationship& relationship) : m_Relationship(relationship) {}
    ITimelineDecoder::Relationship m_Relationship;
    std::vector<Entity*> m_RelatedEntities;
};
using Relationships = std::map<uint64_t, ModelRelationship>;
class TimelineModel
{
public:
    void AddLabel(const ITimelineDecoder::Label& label);
    void AddEntity(uint64_t guid);
    Entity* findEntity(uint64_t id);
    void AddRelationship(const ITimelineDecoder::Relationship& relationship);
    ModelRelationship* findRelationship(uint64_t id);
private:
    LabelMap m_LabelMap;
    Entities m_Entities;
    Relationships m_Relationships;
};

} // namespace profiling

} // namespace armnn