1 // 2 // Copyright © 2020 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 %{ 6 #include "armnn/IProfiler.hpp" 7 %} 8 9 namespace armnn 10 { 11 12 %feature("docstring", 13 " 14 Interface for profiling Arm NN. See `IRuntime.GetProfiler`. 15 16 IProfiler object allows you to enable profiling and get various profiling results. 17 18 ") IProfiler; 19 %nodefaultctor IProfiler; 20 %nodefaultdtor IProfiler; 21 class IProfiler 22 { 23 public: 24 25 %feature("docstring", 26 " 27 Sets the profiler to start/stop profiling. 28 29 Args: 30 enableProfiling (bool): Flag to enable/disable profiling. 31 32 ") EnableProfiling; 33 34 void EnableProfiling(bool enableProfiling); 35 36 %feature("docstring", 37 " 38 Checks if profiling is enabled. 39 40 Returns: 41 bool: If profiling is enabled or not. 42 43 ") IsProfilingEnabled; 44 45 bool IsProfilingEnabled(); 46 }; 47 48 %extend IProfiler { 49 50 %feature("docstring", 51 " 52 Gets the string value of the profiling events analysis log. 53 54 Returns: 55 str: The profiling events analysis log. 56 57 ") event_log; 58 event_log()59 std::string event_log() 60 { 61 std::ostringstream oss; 62 $self->AnalyzeEventsAndWriteResults(oss); 63 return oss.str(); 64 } 65 66 %feature("docstring", 67 " 68 Gets the profiling log as the JSON string. 69 70 Returns: 71 str: Profiling log as JSON formatted string. 72 73 ") as_json; 74 as_json()75 std::string as_json() 76 { 77 std::ostringstream oss; 78 $self->Print(oss); 79 return oss.str(); 80 } 81 } 82 } 83