ArmNN
 25.11
Loading...
Searching...
No Matches
IProfiler.hpp
Go to the documentation of this file.
1//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <iostream>
9#include <memory>
10#include <vector>
11
12namespace armnn
13{
14
15class ProfilerImpl;
16class BackendId;
17class Instrument;
18class Event;
19struct WorkloadInfo;
20
22{
23public:
24 /// Enables/disables profiling for this profiler.
25 /// @param [in] enableProfiling A flag that indicates whether profiling should be enabled or not.
26 void EnableProfiling(bool enableProfiling);
27
28 /// Checks whether profiling is enabled.
29 /// Profiling is disabled by default.
30 /// @return true if profiling is enabled, false otherwise.
31 bool IsProfilingEnabled();
32
33 /// Analyzes the tracked events and writes the results to the given output stream.
34 /// Please refer to the configuration variables in Profiling.cpp to customize the information written.
35 /// @param [out] outStream The stream where to write the profiling results to.
36 void AnalyzeEventsAndWriteResults(std::ostream& outStream) const;
37
38 /// Print stats for events in JSON Format to the given output stream.
39 /// @param [out] outStream The stream where to write the profiling results to.
40 void Print(std::ostream& outStream) const;
41
42 /// Print out details of each layer within the network that possesses a descriptor.
43 /// Also outputs tensor info. This will be part of the profiling json output
45
47 IProfiler();
48
49private:
50
51 using InstrumentPtr = std::unique_ptr<Instrument>;
52
53 template<typename DescriptorType>
54 void AddLayerDetails(const std::string& name,
55 const DescriptorType& desc,
56 const WorkloadInfo& infos,
57 const arm::pipe::ProfilingGuid guid);
58
59 Event* BeginEvent(const BackendId& backendId,
60 const std::string& label,
61 std::vector<InstrumentPtr>&& instruments,
63
64 std::unique_ptr<ProfilerImpl> pProfilerImpl;
65
67
68 template<typename DescriptorType>
69 friend inline void ProfilingUpdateDescriptions(const std::string& name,
70 const DescriptorType& desc,
71 const WorkloadInfo& infos,
72 const arm::pipe::ProfilingGuid guid);
73
74 // Friend functions for unit testing, see ProfilerTests.cpp.
76};
77
78} // namespace armnn
Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Ev...
void Print(std::ostream &outStream) const
Print stats for events in JSON Format to the given output stream.
friend class ScopedProfilingEvent
Definition IProfiler.hpp:66
void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod)
Print out details of each layer within the network that possesses a descriptor.
friend size_t GetProfilerEventSequenceSize(armnn::IProfiler *profiler)
friend void ProfilingUpdateDescriptions(const std::string &name, const DescriptorType &desc, const WorkloadInfo &infos, const arm::pipe::ProfilingGuid guid)
bool IsProfilingEnabled()
Checks whether profiling is enabled.
void AnalyzeEventsAndWriteResults(std::ostream &outStream) const
Analyzes the tracked events and writes the results to the given output stream.
void EnableProfiling(bool enableProfiling)
Enables/disables profiling for this profiler.
Copyright (c) 2021 ARM Limited and Contributors.
ProfilingDetailsMethod
Define the behaviour of the internal profiler when outputting network details.
Definition Types.hpp:72
Contains information about TensorInfos of a layer.