diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/armnn/LoadedNetwork.cpp | 2 | ||||
-rw-r--r-- | src/armnn/Profiling.cpp | 25 | ||||
-rw-r--r-- | src/armnn/Profiling.hpp | 5 |
3 files changed, 21 insertions, 11 deletions
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp index 70b5f4e89b..531d43dbb5 100644 --- a/src/armnn/LoadedNetwork.cpp +++ b/src/armnn/LoadedNetwork.cpp @@ -127,7 +127,7 @@ LoadedNetwork::LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net, m_Profiler->EnableProfiling(networkProperties.m_ProfilingEnabled); - if (networkProperties.m_OutputNetworkDetails) m_Profiler->EnableNetworkDetailsToStdOut(); + m_Profiler->EnableNetworkDetailsToStdOut(networkProperties.m_OutputNetworkDetailsMethod); Graph& order = m_OptimizedNetwork->pOptimizedNetworkImpl->GetGraph().TopologicalSort(); //First create tensor handlers, backends and workload factories. diff --git a/src/armnn/Profiling.cpp b/src/armnn/Profiling.cpp index 8208fd9e0e..7de602fc40 100644 --- a/src/armnn/Profiling.cpp +++ b/src/armnn/Profiling.cpp @@ -163,7 +163,7 @@ void ProfilerImpl::AnalyzeEventSequenceAndWriteResults(ItertType first, ItertTyp ProfilerImpl::ProfilerImpl() : m_ProfilingEnabled(false), - m_EnableDetailsToStdOut(false) + m_DetailsToStdOutMethod(ProfilingDetailsMethod::Undefined) { m_EventSequence.reserve(g_ProfilingEventCountHint); @@ -197,9 +197,9 @@ void ProfilerImpl::EnableProfiling(bool enableProfiling) m_ProfilingEnabled = enableProfiling; } -void ProfilerImpl::EnableNetworkDetailsToStdOut() +void ProfilerImpl::EnableNetworkDetailsToStdOut(ProfilingDetailsMethod details) { - m_EnableDetailsToStdOut = true; + m_DetailsToStdOutMethod = details; } Event* ProfilerImpl::BeginEvent(armnn::IProfiler* profiler, @@ -384,7 +384,9 @@ void ProfilerImpl::Print(std::ostream& outStream) const printer.PrintHeader(); printer.PrintArmNNHeader(); - if (m_ProfilingDetails.get()->DetailsExist() && m_EnableDetailsToStdOut) + if (m_ProfilingDetails.get()->DetailsExist() && + (m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsOnly + || m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsWithEvents)) { JsonChildObject detailsObject{ "layer_details" }; ConfigureDetailsObject(detailsObject, m_ProfilingDetails.get()->GetProfilingDetails()); @@ -395,8 +397,10 @@ void ProfilerImpl::Print(std::ostream& outStream) const // print inference object, also prints child layer and kernel measurements size_t id = 0; - printer.PrintJsonChildObject(inferenceObject, id); - + if (m_DetailsToStdOutMethod != ProfilingDetailsMethod::DetailsOnly) + { + printer.PrintJsonChildObject(inferenceObject, id); + } // end of ArmNN printer.PrintNewLine(); printer.PrintFooter(); @@ -409,6 +413,11 @@ void ProfilerImpl::Print(std::ostream& outStream) const // Restores previous precision settings. outStream.flags(oldFlags); outStream.precision(oldPrecision); + + if (m_DetailsToStdOutMethod == ProfilingDetailsMethod::DetailsOnly) + { + exit(0); + } } void ProfilerImpl::AnalyzeEventsAndWriteResults(std::ostream& outStream) const @@ -545,9 +554,9 @@ void IProfiler::EnableProfiling(bool enableProfiling) pProfilerImpl->EnableProfiling(enableProfiling); } -void IProfiler::EnableNetworkDetailsToStdOut() +void IProfiler::EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod) { - pProfilerImpl->EnableNetworkDetailsToStdOut(); + pProfilerImpl->EnableNetworkDetailsToStdOut(detailsMethod); } bool IProfiler::IsProfilingEnabled() diff --git a/src/armnn/Profiling.hpp b/src/armnn/Profiling.hpp index 372b489abf..42d7f4d638 100644 --- a/src/armnn/Profiling.hpp +++ b/src/armnn/Profiling.hpp @@ -60,7 +60,7 @@ public: bool IsProfilingEnabled(); // Enables outputting the layer descriptors and infos to stdout - void EnableNetworkDetailsToStdOut(); + void EnableNetworkDetailsToStdOut(ProfilingDetailsMethod detailsMethod); // Increments the event tag, allowing grouping of events in a user-defined manner (e.g. per inference). void UpdateEventTag(); @@ -102,7 +102,8 @@ public: std::vector<EventPtr> m_EventSequence; DescPtr m_ProfilingDetails = std::make_unique<ProfilingDetails>(); bool m_ProfilingEnabled; - bool m_EnableDetailsToStdOut; + ProfilingDetailsMethod m_DetailsToStdOutMethod; + }; // Singleton profiler manager. |