aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingGuidGenerator.hpp
blob: 81997e10a7ad70f1dc64ad812ece3b13a2af339f (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
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include "IProfilingGuidGenerator.hpp"

#include <functional>

namespace armnn
{

namespace profiling
{

class ProfilingGuidGenerator : public IProfilingGuidGenerator
{
public:
    /// Construct a generator with the default address space static/dynamic partitioning
    ProfilingGuidGenerator() : m_Sequence(0) {}

    /// Return the next random Guid in the sequence
    // NOTE: dummy implementation for the moment
    inline ProfilingDynamicGuid NextGuid() override
    {
        ProfilingDynamicGuid guid(m_Sequence);
        m_Sequence++;
        return guid;
    }

    /// Create a ProfilingStaticGuid based on a hash of the string
    // NOTE: dummy implementation for the moment
    inline ProfilingStaticGuid GenerateStaticId(const std::string& str) override
    {
        uint64_t guid = static_cast<uint64_t>(m_StringHasher(str));
        return guid;
    }

private:
    std::hash<std::string> m_StringHasher;
    uint64_t m_Sequence;
};

} // namespace profiling

} // namespace armnn