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