aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFrancis Murtagh <francis.murtagh@arm.com>2021-02-15 10:11:28 +0000
committerKeithARM <keith.davis@arm.com>2021-02-15 15:10:09 +0000
commit33199c25e5af1553e474a6f6eede07e888cd45ee (patch)
tree4d7980289479f83eb0cae81a460fb71a184f6dc9 /include
parent406463269f55a5baefb941b51e10f423f6d3250a (diff)
downloadarmnn-33199c25e5af1553e474a6f6eede07e888cd45ee.tar.gz
IVGCVSW-5675 Implement Pimpl Idiom for IProfiler (lower priority)
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com> Change-Id: If716f5f4e9b5433586b8a939d326830482da2f74
Diffstat (limited to 'include')
-rw-r--r--include/armnn/IProfiler.hpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/include/armnn/IProfiler.hpp b/include/armnn/IProfiler.hpp
index 5e6f5087ca..ac422b714f 100644
--- a/include/armnn/IProfiler.hpp
+++ b/include/armnn/IProfiler.hpp
@@ -6,33 +6,50 @@
#pragma once
#include <iostream>
+#include <memory>
+#include <vector>
namespace armnn
{
+class ProfilerImpl;
+class BackendId;
+class Instrument;
+class Event;
class IProfiler
{
public:
/// Enables/disables profiling for this profiler.
/// @param [in] enableProfiling A flag that indicates whether profiling should be enabled or not.
- virtual void EnableProfiling(bool enableProfiling) = 0;
+ void EnableProfiling(bool enableProfiling);
/// Checks whether profiling is enabled.
/// Profiling is disabled by default.
/// @return true if profiling is enabled, false otherwise.
- virtual bool IsProfilingEnabled() = 0;
+ bool IsProfilingEnabled();
/// Analyzes the tracked events and writes the results to the given output stream.
/// Please refer to the configuration variables in Profiling.cpp to customize the information written.
/// @param [out] outStream The stream where to write the profiling results to.
- virtual void AnalyzeEventsAndWriteResults(std::ostream& outStream) const = 0;
+ void AnalyzeEventsAndWriteResults(std::ostream& outStream) const;
/// Print stats for events in JSON Format to the given output stream.
/// @param [out] outStream The stream where to write the profiling results to.
- virtual void Print(std::ostream& outStream) const = 0;
+ void Print(std::ostream& outStream) const;
-protected:
- ~IProfiler() {}
+ ~IProfiler();
+ IProfiler();
+
+private:
+ using InstrumentPtr = std::unique_ptr<Instrument>;
+ Event* BeginEvent(const BackendId& backendId,
+ const std::string& label,
+ std::vector<InstrumentPtr>&& instruments);
+ std::unique_ptr<ProfilerImpl> pProfilerImpl;
+ friend class ScopedProfilingEvent;
+
+ // Friend functions for unit testing, see ProfilerTests.cpp.
+ friend size_t GetProfilerEventSequenceSize(armnn::IProfiler* profiler);
};
} // namespace armnn