• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <client/include/Holder.hpp>
7 
8 namespace arm
9 {
10 
11 namespace pipe
12 {
13 
operator =(const CaptureData & other)14 CaptureData& CaptureData::operator=(const CaptureData& other)
15 {
16     m_CapturePeriod  = other.m_CapturePeriod;
17     m_CounterIds     = other.m_CounterIds;
18     m_ActiveBackends = other.m_ActiveBackends;
19 
20     return *this;
21 }
22 
SetActiveBackends(const std::set<std::string> & activeBackends)23 void CaptureData::SetActiveBackends(const std::set<std::string>& activeBackends)
24 {
25     m_ActiveBackends = activeBackends;
26 }
27 
SetCapturePeriod(uint32_t capturePeriod)28 void CaptureData::SetCapturePeriod(uint32_t capturePeriod)
29 {
30     m_CapturePeriod = capturePeriod;
31 }
32 
SetCounterIds(const std::vector<uint16_t> & counterIds)33 void CaptureData::SetCounterIds(const std::vector<uint16_t>& counterIds)
34 {
35     m_CounterIds = counterIds;
36 }
37 
GetActiveBackends() const38 const std::set<std::string>& CaptureData::GetActiveBackends() const
39 {
40     return m_ActiveBackends;
41 }
42 
GetCapturePeriod() const43 uint32_t CaptureData::GetCapturePeriod() const
44 {
45     return m_CapturePeriod;
46 }
47 
GetCounterIds() const48 const std::vector<uint16_t>& CaptureData::GetCounterIds() const
49 {
50     return m_CounterIds;
51 }
52 
GetCaptureData() const53 CaptureData Holder::GetCaptureData() const
54 {
55 #if !defined(ARMNN_DISABLE_THREADS)
56     std::lock_guard<std::mutex> lockGuard(m_CaptureThreadMutex);
57 #endif
58     return m_CaptureData;
59 }
60 
IsCounterIdInCaptureData(uint16_t counterId)61 bool CaptureData::IsCounterIdInCaptureData(uint16_t counterId)
62 {
63     for (auto m_CounterId : m_CounterIds) {
64         if (m_CounterId == counterId)
65         {
66             return true;
67         }
68     }
69 
70     // Return false by default unless counterId is found
71     return false;
72 }
73 
SetCaptureData(uint32_t capturePeriod,const std::vector<uint16_t> & counterIds,const std::set<std::string> & activeBackends)74 void Holder::SetCaptureData(uint32_t capturePeriod,
75                             const std::vector<uint16_t>& counterIds,
76                             const std::set<std::string>& activeBackends)
77 {
78 #if !defined(ARMNN_DISABLE_THREADS)
79     std::lock_guard<std::mutex> lockGuard(m_CaptureThreadMutex);
80 #endif
81     m_CaptureData.SetCapturePeriod(capturePeriod);
82     m_CaptureData.SetCounterIds(counterIds);
83     m_CaptureData.SetActiveBackends(activeBackends);
84 
85 }
86 
87 } // namespace pipe
88 
89 } // namespace arm
90