diff options
author | Keith Davis <keith.davis@arm.com> | 2021-07-20 11:25:22 +0100 |
---|---|---|
committer | Keith Davis <keith.davis@arm.com> | 2021-08-04 11:49:16 +0100 |
commit | 554fa09a0f3d6c9c572634c9d2de9bfb6c3218b0 (patch) | |
tree | 1820a2cadcc1f34667199acff2d044e5d2083ea2 /src/armnn/JsonPrinter.cpp | |
parent | 96fd98c28441618fbdf9376fe46a368ef06b19e1 (diff) | |
download | armnn-554fa09a0f3d6c9c572634c9d2de9bfb6c3218b0.tar.gz |
IVGCVSW-5980 JSON profiling output
* Add new ProfilingDetails class to construct operator details string
* Add new macro which helps append layer details to ostream
* Add ProfilingEnabled to NetworkProperties so that profiling can be
realised when loading the network
* Add further optional info to WorkloadInfo specific to convolutions
* Generalise some JsonPrinter functions into JsonUtils for reusability
* Remove explicit enabling of profiling within InferenceModel as it is
done when loading network
* Add ProfilingDetails macros to ConvolutionWorkloads for validation
Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: Ie84bc7dc667e72e6bcb635544f9ead7af1765690
Diffstat (limited to 'src/armnn/JsonPrinter.cpp')
-rw-r--r-- | src/armnn/JsonPrinter.cpp | 81 |
1 files changed, 23 insertions, 58 deletions
diff --git a/src/armnn/JsonPrinter.cpp b/src/armnn/JsonPrinter.cpp index 9dc648c538..986edb9e6d 100644 --- a/src/armnn/JsonPrinter.cpp +++ b/src/armnn/JsonPrinter.cpp @@ -21,15 +21,17 @@ void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id id++; } - PrintLabel(object.m_Label, id); - PrintType(object.m_Type); + if (object.GetType() != JsonObjectType::ExecObjectDesc) + { + PrintLabel(object.m_Label, id); + PrintType(object.m_Type); + } if (!object.m_Measurements.empty() || !object.m_Children.empty()) { PrintSeparator(); PrintNewLine(); } - if (object.GetType() == JsonObjectType::Measurement) { PrintMeasurementsList(object.m_Measurements); @@ -37,6 +39,15 @@ void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id PrintNewLine(); PrintUnit(object.m_Unit); } + else if (object.GetType() == JsonObjectType::ExecObjectDesc) + { + for (std::string stringLine : object.m_LayerDetailsList) + { + PrintTabs(); + m_OutputStream << stringLine; + PrintNewLine(); + } + } if (!object.m_Children.empty()) { for (unsigned int childIndex = 0; childIndex < object.m_Children.size(); ++childIndex) @@ -50,21 +61,11 @@ void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id } } } - PrintNewLine(); - PrintFooter(); -} - -void JsonPrinter::PrintHeader() -{ - m_OutputStream << "{" << std::endl; - IncrementNumberOfTabs(); -} - -void JsonPrinter::PrintArmNNHeader() -{ - PrintTabs(); - m_OutputStream << R"("ArmNN": {)" << std::endl; - IncrementNumberOfTabs(); + if (object.GetType() != JsonObjectType::ExecObjectDesc) + { + PrintNewLine(); + PrintFooter(); + } } std::string JsonPrinter::MakeKey(const std::string& label, size_t id) @@ -103,6 +104,10 @@ void JsonPrinter::PrintType(armnn::JsonObjectType type) { return "Event"; } + case JsonObjectType::ExecObjectDesc: + { + return "Operator Description"; + } default: { return "Unknown"; @@ -141,44 +146,4 @@ void JsonPrinter::PrintMeasurementsList(const std::vector<double>& measurementsV m_OutputStream << "]"; } -void JsonPrinter::PrintTabs() -{ - unsigned int numTabs = m_NumTabs; - while (numTabs-- > 0) - { - m_OutputStream << "\t"; - } -} - -void JsonPrinter::PrintSeparator() -{ - m_OutputStream << ","; -} - -void JsonPrinter::PrintNewLine() -{ - m_OutputStream << std::endl; -} - -void JsonPrinter::PrintFooter() -{ - DecrementNumberOfTabs(); - PrintTabs(); - m_OutputStream << "}"; -} - -void JsonPrinter::DecrementNumberOfTabs() -{ - if (m_NumTabs == 0) - { - return; - } - --m_NumTabs; -} - -void JsonPrinter::IncrementNumberOfTabs() -{ - ++m_NumTabs; -} - } // namespace armnn
\ No newline at end of file |