Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 1 | // |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include "CounterIdMap.hpp" |
| 9 | #include "Holder.hpp" |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 10 | #include "ICounterValues.hpp" |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 11 | #include "IInitialiseProfilingService.hpp" |
Jim Flynn | 6398a98 | 2020-05-27 17:05:21 +0100 | [diff] [blame] | 12 | #include "IProfilingServiceStatus.hpp" |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 13 | #include "ISendCounterPacket.hpp" |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 14 | #include "IReportStructure.hpp" |
| 15 | #include "ProfilingState.hpp" |
Nikhil Raj | 5b1bcc9 | 2021-06-08 12:31:50 +0100 | [diff] [blame] | 16 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 17 | #include <armnn/backends/profiling/IBackendProfilingContext.hpp> |
| 18 | #include <armnn/profiling/ProfilingOptions.hpp> |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 19 | |
Jim Flynn | c454ac9 | 2022-03-16 18:43:18 +0000 | [diff] [blame^] | 20 | #include <common/include/ICounterRegistry.hpp> |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 21 | #include <common/include/Optional.hpp> |
Nikhil Raj | 5b1bcc9 | 2021-06-08 12:31:50 +0100 | [diff] [blame] | 22 | #include <common/include/ProfilingGuidGenerator.hpp> |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 23 | |
Jim Flynn | c454ac9 | 2022-03-16 18:43:18 +0000 | [diff] [blame^] | 24 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 25 | namespace arm |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 26 | { |
| 27 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 28 | namespace pipe |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 29 | { |
| 30 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 31 | class IProfilingService : public IProfilingGuidGenerator, |
| 32 | public IProfilingServiceStatus, |
| 33 | public IReadWriteCounterValues |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 34 | { |
| 35 | public: |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 36 | static std::unique_ptr<IProfilingService> CreateProfilingService( |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 37 | uint16_t maxGlobalCounterId, |
| 38 | IInitialiseProfilingService& initialiser, |
Jim Flynn | 9c85b41 | 2022-03-16 00:27:43 +0000 | [diff] [blame] | 39 | const std::string& softwareInfo, |
| 40 | const std::string& softwareVersion, |
| 41 | const std::string& hardwareVersion, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 42 | arm::pipe::Optional<IReportStructure&> reportStructure = arm::pipe::EmptyOptional()); |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 43 | virtual ~IProfilingService() {}; |
| 44 | virtual std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const = 0; |
| 45 | virtual const ICounterMappings& GetCounterMappings() const = 0; |
| 46 | virtual ISendCounterPacket& GetSendCounterPacket() = 0; |
| 47 | virtual bool IsProfilingEnabled() const = 0; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 48 | virtual bool IsTimelineReportingEnabled() const = 0; |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 49 | virtual CaptureData GetCaptureData() = 0; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 50 | virtual ProfilingState GetCurrentState() const = 0; |
| 51 | // Resets the profiling options, optionally clears the profiling service entirely |
| 52 | virtual void ResetExternalProfilingOptions(const ProfilingOptions& options, |
| 53 | bool resetProfilingService = false) = 0; |
| 54 | virtual ProfilingState ConfigureProfilingService(const ProfilingOptions& options, |
| 55 | bool resetProfilingService = false) = 0; |
| 56 | // Store a profiling context returned from a backend that support profiling. |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame] | 57 | virtual void AddBackendProfilingContext(const std::string& backendId, |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 58 | std::shared_ptr<IBackendProfilingContext> profilingContext) = 0; |
| 59 | virtual ICounterRegistry& GetCounterRegistry() = 0; |
| 60 | virtual IRegisterCounterMapping& GetCounterMappingRegistry() = 0; |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 61 | virtual bool IsCategoryRegistered(const std::string& categoryName) const = 0; |
| 62 | virtual void InitializeCounterValue(uint16_t counterUid) = 0; |
| 63 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 64 | // IProfilingGuidGenerator functions |
| 65 | /// Return the next random Guid in the sequence |
| 66 | ProfilingDynamicGuid NextGuid() override; |
| 67 | /// Create a ProfilingStaticGuid based on a hash of the string |
| 68 | ProfilingStaticGuid GenerateStaticId(const std::string& str) override; |
| 69 | static ProfilingDynamicGuid GetNextGuid(); |
| 70 | static ProfilingStaticGuid GetStaticId(const std::string& str); |
| 71 | void ResetGuidGenerator(); |
| 72 | |
Jim Flynn | 3443025 | 2022-03-04 15:03:58 +0000 | [diff] [blame] | 73 | virtual void Disconnect() = 0; |
| 74 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 75 | private: |
| 76 | static ProfilingGuidGenerator m_GuidGenerator; |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 79 | } // namespace pipe |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 80 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 81 | } // namespace arm |