blob: 31d9b8d1e316493bd8a83ca25039ecf105908dfc [file] [log] [blame]
Jim Flynn64063552020-02-14 10:18:08 +00001//
Jim Flynn6398a982020-05-27 17:05:21 +01002// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
Jim Flynn64063552020-02-14 10:18:08 +00003// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include "CounterIdMap.hpp"
9#include "Holder.hpp"
Jim Flynnaf947722022-03-02 11:04:47 +000010#include "ICounterValues.hpp"
11#include "ICounterRegistry.hpp"
Jim Flynn6398a982020-05-27 17:05:21 +010012#include "IProfilingServiceStatus.hpp"
Jim Flynn64063552020-02-14 10:18:08 +000013#include "ISendCounterPacket.hpp"
Jim Flynnaf947722022-03-02 11:04:47 +000014#include "IReportStructure.hpp"
15#include "ProfilingState.hpp"
Nikhil Raj5b1bcc92021-06-08 12:31:50 +010016
Jim Flynnaf947722022-03-02 11:04:47 +000017#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
18#include <armnn/profiling/ProfilingOptions.hpp>
19#include <armnn/Optional.hpp>
Nikhil Raj5b1bcc92021-06-08 12:31:50 +010020#include <common/include/ProfilingGuidGenerator.hpp>
Jim Flynn64063552020-02-14 10:18:08 +000021
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000022namespace arm
Jim Flynn64063552020-02-14 10:18:08 +000023{
24
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000025namespace pipe
Jim Flynn64063552020-02-14 10:18:08 +000026{
27
Jim Flynnaf947722022-03-02 11:04:47 +000028class IProfilingService : public IProfilingGuidGenerator,
29 public IProfilingServiceStatus,
30 public IReadWriteCounterValues
Jim Flynn64063552020-02-14 10:18:08 +000031{
32public:
Jim Flynnaf947722022-03-02 11:04:47 +000033 static std::unique_ptr<IProfilingService> CreateProfilingService(
34 armnn::Optional<IReportStructure&> reportStructure = armnn::EmptyOptional());
Jim Flynn64063552020-02-14 10:18:08 +000035 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 Flynnaf947722022-03-02 11:04:47 +000040 virtual bool IsTimelineReportingEnabled() const = 0;
Jim Flynn64063552020-02-14 10:18:08 +000041 virtual CaptureData GetCaptureData() = 0;
Jim Flynnaf947722022-03-02 11:04:47 +000042 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.
49 virtual void AddBackendProfilingContext(const armnn::BackendId backendId,
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
62private:
63 static ProfilingGuidGenerator m_GuidGenerator;
Jim Flynn64063552020-02-14 10:18:08 +000064};
65
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000066} // namespace pipe
Jim Flynn64063552020-02-14 10:18:08 +000067
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000068} // namespace arm