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" |
| 11 | #include "ICounterRegistry.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> |
| 19 | #include <armnn/Optional.hpp> |
Nikhil Raj | 5b1bcc9 | 2021-06-08 12:31:50 +0100 | [diff] [blame] | 20 | #include <common/include/ProfilingGuidGenerator.hpp> |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 21 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 22 | namespace arm |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 23 | { |
| 24 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 25 | namespace pipe |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 26 | { |
| 27 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 28 | class IProfilingService : public IProfilingGuidGenerator, |
| 29 | public IProfilingServiceStatus, |
| 30 | public IReadWriteCounterValues |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 31 | { |
| 32 | public: |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 33 | static std::unique_ptr<IProfilingService> CreateProfilingService( |
| 34 | armnn::Optional<IReportStructure&> reportStructure = armnn::EmptyOptional()); |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 35 | virtual ~IProfilingService() {}; |
| 36 | virtual std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const = 0; |
| 37 | virtual const ICounterMappings& GetCounterMappings() const = 0; |
| 38 | virtual ISendCounterPacket& GetSendCounterPacket() = 0; |
| 39 | virtual bool IsProfilingEnabled() const = 0; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 40 | virtual bool IsTimelineReportingEnabled() const = 0; |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 41 | virtual CaptureData GetCaptureData() = 0; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 42 | virtual ProfilingState GetCurrentState() const = 0; |
| 43 | // Resets the profiling options, optionally clears the profiling service entirely |
| 44 | virtual void ResetExternalProfilingOptions(const ProfilingOptions& options, |
| 45 | bool resetProfilingService = false) = 0; |
| 46 | virtual ProfilingState ConfigureProfilingService(const ProfilingOptions& options, |
| 47 | bool resetProfilingService = false) = 0; |
| 48 | // Store a profiling context returned from a backend that support profiling. |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame^] | 49 | virtual void AddBackendProfilingContext(const std::string& backendId, |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 50 | std::shared_ptr<IBackendProfilingContext> profilingContext) = 0; |
| 51 | virtual ICounterRegistry& GetCounterRegistry() = 0; |
| 52 | virtual IRegisterCounterMapping& GetCounterMappingRegistry() = 0; |
| 53 | // IProfilingGuidGenerator functions |
| 54 | /// Return the next random Guid in the sequence |
| 55 | ProfilingDynamicGuid NextGuid() override; |
| 56 | /// Create a ProfilingStaticGuid based on a hash of the string |
| 57 | ProfilingStaticGuid GenerateStaticId(const std::string& str) override; |
| 58 | static ProfilingDynamicGuid GetNextGuid(); |
| 59 | static ProfilingStaticGuid GetStaticId(const std::string& str); |
| 60 | void ResetGuidGenerator(); |
| 61 | |
| 62 | private: |
| 63 | static ProfilingGuidGenerator m_GuidGenerator; |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 66 | } // namespace pipe |
Jim Flynn | 6406355 | 2020-02-14 10:18:08 +0000 | [diff] [blame] | 67 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 68 | } // namespace arm |