xref: /aosp_15_r20/external/armnn/profiling/client/src/IProfilingService.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1*89c4ff92SAndroid Build Coastguard Worker //
2*89c4ff92SAndroid Build Coastguard Worker // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3*89c4ff92SAndroid Build Coastguard Worker // SPDX-License-Identifier: MIT
4*89c4ff92SAndroid Build Coastguard Worker //
5*89c4ff92SAndroid Build Coastguard Worker 
6*89c4ff92SAndroid Build Coastguard Worker #include "ProfilingService.hpp"
7*89c4ff92SAndroid Build Coastguard Worker 
8*89c4ff92SAndroid Build Coastguard Worker #include <client/include/IProfilingService.hpp>
9*89c4ff92SAndroid Build Coastguard Worker 
10*89c4ff92SAndroid Build Coastguard Worker namespace arm
11*89c4ff92SAndroid Build Coastguard Worker {
12*89c4ff92SAndroid Build Coastguard Worker 
13*89c4ff92SAndroid Build Coastguard Worker namespace pipe
14*89c4ff92SAndroid Build Coastguard Worker {
15*89c4ff92SAndroid Build Coastguard Worker 
CreateProfilingService(uint16_t maxGlobalCounterId,IInitialiseProfilingService & initialiser,const std::string & softwareInfo,const std::string & softwareVersion,const std::string & hardwareVersion,arm::pipe::Optional<IReportStructure &> reportStructure)16*89c4ff92SAndroid Build Coastguard Worker std::unique_ptr<IProfilingService> IProfilingService::CreateProfilingService(
17*89c4ff92SAndroid Build Coastguard Worker     uint16_t maxGlobalCounterId,
18*89c4ff92SAndroid Build Coastguard Worker     IInitialiseProfilingService& initialiser,
19*89c4ff92SAndroid Build Coastguard Worker     const std::string& softwareInfo,
20*89c4ff92SAndroid Build Coastguard Worker     const std::string& softwareVersion,
21*89c4ff92SAndroid Build Coastguard Worker     const std::string& hardwareVersion,
22*89c4ff92SAndroid Build Coastguard Worker     arm::pipe::Optional<IReportStructure&> reportStructure)
23*89c4ff92SAndroid Build Coastguard Worker {
24*89c4ff92SAndroid Build Coastguard Worker     return std::make_unique<ProfilingService>(maxGlobalCounterId,
25*89c4ff92SAndroid Build Coastguard Worker                                               initialiser,
26*89c4ff92SAndroid Build Coastguard Worker                                               softwareInfo,
27*89c4ff92SAndroid Build Coastguard Worker                                               softwareVersion,
28*89c4ff92SAndroid Build Coastguard Worker                                               hardwareVersion,
29*89c4ff92SAndroid Build Coastguard Worker                                               reportStructure);
30*89c4ff92SAndroid Build Coastguard Worker }
31*89c4ff92SAndroid Build Coastguard Worker 
32*89c4ff92SAndroid Build Coastguard Worker ProfilingGuidGenerator IProfilingService::m_GuidGenerator;
33*89c4ff92SAndroid Build Coastguard Worker 
GetNextGuid()34*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid IProfilingService::GetNextGuid()
35*89c4ff92SAndroid Build Coastguard Worker {
36*89c4ff92SAndroid Build Coastguard Worker     return m_GuidGenerator.NextGuid();
37*89c4ff92SAndroid Build Coastguard Worker }
38*89c4ff92SAndroid Build Coastguard Worker 
GetStaticId(const std::string & str)39*89c4ff92SAndroid Build Coastguard Worker ProfilingStaticGuid IProfilingService::GetStaticId(const std::string& str)
40*89c4ff92SAndroid Build Coastguard Worker {
41*89c4ff92SAndroid Build Coastguard Worker     return m_GuidGenerator.GenerateStaticId(str);
42*89c4ff92SAndroid Build Coastguard Worker }
43*89c4ff92SAndroid Build Coastguard Worker 
ResetGuidGenerator()44*89c4ff92SAndroid Build Coastguard Worker void IProfilingService::ResetGuidGenerator()
45*89c4ff92SAndroid Build Coastguard Worker {
46*89c4ff92SAndroid Build Coastguard Worker     m_GuidGenerator.Reset();
47*89c4ff92SAndroid Build Coastguard Worker }
48*89c4ff92SAndroid Build Coastguard Worker 
NextGuid()49*89c4ff92SAndroid Build Coastguard Worker ProfilingDynamicGuid IProfilingService::NextGuid()
50*89c4ff92SAndroid Build Coastguard Worker {
51*89c4ff92SAndroid Build Coastguard Worker     return IProfilingService::GetNextGuid();
52*89c4ff92SAndroid Build Coastguard Worker }
53*89c4ff92SAndroid Build Coastguard Worker 
GenerateStaticId(const std::string & str)54*89c4ff92SAndroid Build Coastguard Worker ProfilingStaticGuid IProfilingService::GenerateStaticId(const std::string& str)
55*89c4ff92SAndroid Build Coastguard Worker {
56*89c4ff92SAndroid Build Coastguard Worker     return IProfilingService::GetStaticId(str);
57*89c4ff92SAndroid Build Coastguard Worker }
58*89c4ff92SAndroid Build Coastguard Worker 
59*89c4ff92SAndroid Build Coastguard Worker } // namespace pipe
60*89c4ff92SAndroid Build Coastguard Worker } // namespace arm
61