aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/JsonPrinter.hpp
diff options
context:
space:
mode:
authorDerek Lamberti <derek.lamberti@arm.com>2019-08-07 17:01:57 +0100
committerDerek Lamberti <derek.lamberti@arm.com>2019-08-09 12:17:50 +0000
commit6b4dfc2df9271b2e9e0b9e0e0a78f715ddebf36e (patch)
tree7fe9cc2e8b023cb138e5e2af07feeec7c3857dc4 /src/armnn/JsonPrinter.hpp
parent3d8a9eda15c7732c689a80ddde916d6e3373542c (diff)
downloadarmnn-6b4dfc2df9271b2e9e0b9e0e0a78f715ddebf36e.tar.gz
IVGCVSW-3603 *Json printer prints full profiling hierarchy
Change-Id: Ide5acbf993c2bcff5265b72fc979caa6f183bb22 Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'src/armnn/JsonPrinter.hpp')
-rw-r--r--src/armnn/JsonPrinter.hpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/armnn/JsonPrinter.hpp b/src/armnn/JsonPrinter.hpp
index 12a0891a97..04f56b0134 100644
--- a/src/armnn/JsonPrinter.hpp
+++ b/src/armnn/JsonPrinter.hpp
@@ -8,16 +8,23 @@
#include <ostream>
#include <string.h>
#include <map>
+#include <set>
#include "Instrument.hpp"
namespace armnn
{
+enum class JsonObjectType
+{
+ Measurement,
+ Event
+};
+
struct JsonChildObject
{
JsonChildObject(const std::string& label)
- : m_Label(label), m_Unit(Measurement::Unit::TIME_MS)
+ : m_Label(label), m_Unit(Measurement::Unit::TIME_MS), m_Type(JsonObjectType::Event)
{}
JsonChildObject(const JsonChildObject&) = default;
@@ -31,7 +38,7 @@ struct JsonChildObject
m_Children.push_back(childObject);
}
- JsonChildObject GetChild(const unsigned int index)
+ JsonChildObject& GetChild(const unsigned int index)
{
return m_Children[index];
}
@@ -41,10 +48,26 @@ struct JsonChildObject
m_Unit = unit;
}
+ size_t NumChildren() const
+ {
+ return m_Children.size();
+ }
+
+ void SetType(JsonObjectType type)
+ {
+ m_Type = type;
+ }
+
+ JsonObjectType GetType() const
+ {
+ return m_Type;
+ }
+
~JsonChildObject() = default;
std::string m_Label;
Measurement::Unit m_Unit;
+ JsonObjectType m_Type;
std::vector<double> m_Measurements;
std::vector<JsonChildObject> m_Children;
@@ -55,14 +78,15 @@ private:
class JsonPrinter
{
public:
- void PrintJsonChildObject(const JsonChildObject& object);
+ void PrintJsonChildObject(const JsonChildObject& object, size_t& id);
void PrintHeader();
void PrintArmNNHeader();
void PrintFooter();
void PrintSeparator();
void PrintNewLine();
- void PrintLabel(const std::string& label);
+ void PrintLabel(const std::string& label, size_t id);
void PrintUnit(armnn::Measurement::Unit unit);
+ void PrintType(armnn::JsonObjectType type);
void PrintMeasurementsList(const std::vector<double>& measurementsVector);
public:
@@ -71,6 +95,7 @@ public:
{}
private:
+ std::string MakeKey(const std::string& label, size_t id);
void PrintTabs();
void DecrementNumberOfTabs();
void IncrementNumberOfTabs();