From 245d64c60d0ea30f5080ff53225b5169927e24d6 Mon Sep 17 00:00:00 2001 From: Matthew Bentham Date: Mon, 2 Dec 2019 12:59:43 +0000 Subject: Work in progress of python bindings for Arm NN Not built or tested in any way Signed-off-by: Matthew Bentham Change-Id: Ie7f92b529aa5087130f0c5cc8c17db1581373236 --- .../src/pyarmnn/swig/modules/armnn_profiler.i | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 python/pyarmnn/src/pyarmnn/swig/modules/armnn_profiler.i (limited to 'python/pyarmnn/src/pyarmnn/swig/modules/armnn_profiler.i') diff --git a/python/pyarmnn/src/pyarmnn/swig/modules/armnn_profiler.i b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_profiler.i new file mode 100644 index 0000000000..929a7a0006 --- /dev/null +++ b/python/pyarmnn/src/pyarmnn/swig/modules/armnn_profiler.i @@ -0,0 +1,82 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// +%{ +#include "armnn/IProfiler.hpp" +%} + +namespace armnn +{ + +%feature("docstring", +" +Interface for profiling Arm NN. See `IRuntime.GetProfiler`. + +IProfiler object allows you to enable profiling and get various profiling results. + +") IProfiler; +%nodefaultctor IProfiler; +%nodefaultdtor IProfiler; +class IProfiler +{ +public: + + %feature("docstring", + " + Sets the profiler to start/stop profiling. + + Args: + enableProfiling (bool): Flag to enable/disable profiling. + + ") EnableProfiling; + + void EnableProfiling(bool enableProfiling); + + %feature("docstring", + " + Checks if profiling is enabled. + + Returns: + bool: If profiling is enabled or not. + + ") IsProfilingEnabled; + + bool IsProfilingEnabled(); +}; + +%extend IProfiler { + + %feature("docstring", + " + Gets the string value of the profiling events analysis log. + + Returns: + str: The profiling events analysis log. + + ") event_log; + + std::string event_log() + { + std::ostringstream oss; + $self->AnalyzeEventsAndWriteResults(oss); + return oss.str(); + } + + %feature("docstring", + " + Gets the profiling log as the JSON string. + + Returns: + str: Profiling log as JSON formatted string. + + ") as_json; + + std::string as_json() + { + std::ostringstream oss; + $self->Print(oss); + return oss.str(); + } +} +} -- cgit v1.2.1