• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017, 2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <mutex>
9 #include <vector>
10 #include <set>
11 #include <string>
12 
13 namespace arm
14 {
15 
16 namespace pipe
17 {
18 
19 class CaptureData
20 {
21 public:
CaptureData()22     CaptureData()
23         : m_CapturePeriod(0)
24         , m_CounterIds()
25         , m_ActiveBackends(){}
CaptureData(uint32_t capturePeriod,std::vector<uint16_t> & counterIds,std::set<std::string> activeBackends)26     CaptureData(uint32_t capturePeriod, std::vector<uint16_t>& counterIds, std::set<std::string> activeBackends)
27         : m_CapturePeriod(capturePeriod)
28         , m_CounterIds(counterIds)
29         , m_ActiveBackends(activeBackends){}
CaptureData(const CaptureData & captureData)30     CaptureData(const CaptureData& captureData)
31         : m_CapturePeriod(captureData.m_CapturePeriod)
32         , m_CounterIds(captureData.m_CounterIds)
33         , m_ActiveBackends(captureData.m_ActiveBackends){}
34 
35     CaptureData& operator=(const CaptureData& other);
36 
37     void SetActiveBackends(const std::set<std::string>& activeBackends);
38     void SetCapturePeriod(uint32_t capturePeriod);
39     void SetCounterIds(const std::vector<uint16_t>& counterIds);
40     uint32_t GetCapturePeriod() const;
41     const std::vector<uint16_t>& GetCounterIds() const;
42     const std::set<std::string>& GetActiveBackends() const;
43     bool IsCounterIdInCaptureData(uint16_t counterId);
44 
45 private:
46     uint32_t m_CapturePeriod;
47     std::vector<uint16_t> m_CounterIds;
48     std::set<std::string> m_ActiveBackends;
49 };
50 
51 class Holder
52 {
53 public:
Holder()54     Holder()
55         : m_CaptureData() {}
56     CaptureData GetCaptureData() const;
57     void SetCaptureData(uint32_t capturePeriod,
58                         const std::vector<uint16_t>& counterIds,
59                         const std::set<std::string>& activeBackends);
60 
61 private:
62 #if !defined(ARMNN_DISABLE_THREADS)
63     mutable std::mutex m_CaptureThreadMutex;
64 #endif
65     CaptureData m_CaptureData;
66 };
67 
68 } // namespace pipe
69 
70 } // namespace arm
71