diff options
author | Keith Davis <keith.davis@arm.com> | 2020-03-05 16:25:28 +0000 |
---|---|---|
committer | Keith Davis Arm <keith.davis@arm.com> | 2020-03-09 16:11:25 +0000 |
commit | 97da5e2e6c8aaaf4249af60e8305431315226f15 (patch) | |
tree | c36f01055cbf0f9577bca95f64ca6de42c923a77 /src/timelineDecoder | |
parent | 53d092d34c1e9924151d8d3a228c04620c1baf5c (diff) | |
download | armnn-97da5e2e6c8aaaf4249af60e8305431315226f15.tar.gz |
IVGCVSW-4541 Modify Timeline Packet construction
* Changed TimelinePacket encoding so that there is only one header for
multiple timeline swtrace messages
* Refactored function names to have more suitable description
* Refactored CodeStyle to coincide with ArmNN coding standards
* Refactored profiling test names to be descriptive
* Refactored ErrorCode name to TimelineStatus
* Updated existing unit tests
Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: I83bd4bb9e7393617bca97eba96a6e1388916e5b0
Diffstat (limited to 'src/timelineDecoder')
-rw-r--r-- | src/timelineDecoder/TimelineDecoder.cpp | 60 | ||||
-rw-r--r-- | src/timelineDecoder/TimelineDecoder.hpp | 20 | ||||
-rw-r--r-- | src/timelineDecoder/tests/TimelineTests.cpp | 16 |
3 files changed, 47 insertions, 49 deletions
diff --git a/src/timelineDecoder/TimelineDecoder.cpp b/src/timelineDecoder/TimelineDecoder.cpp index fcf40b4522..2f9ac135b4 100644 --- a/src/timelineDecoder/TimelineDecoder.cpp +++ b/src/timelineDecoder/TimelineDecoder.cpp @@ -11,58 +11,58 @@ namespace armnn { namespace timelinedecoder { -TimelineDecoder::ErrorCode TimelineDecoder::CreateEntity(const Entity &entity) +TimelineDecoder::TimelineStatus TimelineDecoder::CreateEntity(const Entity &entity) { if (m_OnNewEntityCallback == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEntityCallback(m_Model, entity); - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::CreateEventClass(const EventClass &eventClass) +TimelineDecoder::TimelineStatus TimelineDecoder::CreateEventClass(const EventClass &eventClass) { if (m_OnNewEventClassCallback == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEventClassCallback(m_Model, eventClass); - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::CreateEvent(const Event &event) +TimelineDecoder::TimelineStatus TimelineDecoder::CreateEvent(const Event &event) { if (m_OnNewEventCallback == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEventCallback(m_Model, event); - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::CreateLabel(const Label &label) +TimelineDecoder::TimelineStatus TimelineDecoder::CreateLabel(const Label &label) { if (m_OnNewLabelCallback == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewLabelCallback(m_Model, label); - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::CreateRelationship(const Relationship &relationship) +TimelineDecoder::TimelineStatus TimelineDecoder::CreateRelationship(const Relationship &relationship) { if (m_OnNewRelationshipCallback == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewRelationshipCallback(m_Model, relationship); - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } const TimelineDecoder::Model &TimelineDecoder::GetModel() @@ -70,54 +70,54 @@ const TimelineDecoder::Model &TimelineDecoder::GetModel() return m_Model; } -TimelineDecoder::ErrorCode TimelineDecoder::SetEntityCallback(OnNewEntityCallback cb) +TimelineDecoder::TimelineStatus TimelineDecoder::SetEntityCallback(OnNewEntityCallback cb) { if (cb == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEntityCallback = cb; - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::SetEventClassCallback(OnNewEventClassCallback cb) +TimelineDecoder::TimelineStatus TimelineDecoder::SetEventClassCallback(OnNewEventClassCallback cb) { if (cb == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEventClassCallback = cb; - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::SetEventCallback(OnNewEventCallback cb) +TimelineDecoder::TimelineStatus TimelineDecoder::SetEventCallback(OnNewEventCallback cb) { if (cb == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewEventCallback = cb; - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::SetLabelCallback(OnNewLabelCallback cb) +TimelineDecoder::TimelineStatus TimelineDecoder::SetLabelCallback(OnNewLabelCallback cb) { if (cb == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewLabelCallback = cb; - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } -TimelineDecoder::ErrorCode TimelineDecoder::SetRelationshipCallback(OnNewRelationshipCallback cb) +TimelineDecoder::TimelineStatus TimelineDecoder::SetRelationshipCallback(OnNewRelationshipCallback cb) { if (cb == nullptr) { - return ErrorCode::ErrorCode_Fail; + return TimelineStatus::TimelineStatus_Fail; } m_OnNewRelationshipCallback = cb; - return ErrorCode::ErrorCode_Success; + return TimelineStatus::TimelineStatus_Success; } void TimelineDecoder::print() diff --git a/src/timelineDecoder/TimelineDecoder.hpp b/src/timelineDecoder/TimelineDecoder.hpp index fc14603927..405673164b 100644 --- a/src/timelineDecoder/TimelineDecoder.hpp +++ b/src/timelineDecoder/TimelineDecoder.hpp @@ -31,20 +31,20 @@ public: using OnNewLabelCallback = void (*)(Model &, const Label); using OnNewRelationshipCallback = void (*)(Model &, const Relationship); - virtual ErrorCode CreateEntity(const Entity &) override; - virtual ErrorCode CreateEventClass(const EventClass &) override; - virtual ErrorCode CreateEvent(const Event &) override; - virtual ErrorCode CreateLabel(const Label &) override; - virtual ErrorCode CreateRelationship(const Relationship &) override; + virtual TimelineStatus CreateEntity(const Entity &) override; + virtual TimelineStatus CreateEventClass(const EventClass &) override; + virtual TimelineStatus CreateEvent(const Event &) override; + virtual TimelineStatus CreateLabel(const Label &) override; + virtual TimelineStatus CreateRelationship(const Relationship &) override; const Model& GetModel(); - ErrorCode SetEntityCallback(const OnNewEntityCallback); - ErrorCode SetEventClassCallback(const OnNewEventClassCallback); - ErrorCode SetEventCallback(const OnNewEventCallback); - ErrorCode SetLabelCallback(const OnNewLabelCallback); - ErrorCode SetRelationshipCallback(const OnNewRelationshipCallback); + TimelineStatus SetEntityCallback(const OnNewEntityCallback); + TimelineStatus SetEventClassCallback(const OnNewEventClassCallback); + TimelineStatus SetEventCallback(const OnNewEventCallback); + TimelineStatus SetLabelCallback(const OnNewLabelCallback); + TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback); void print(); diff --git a/src/timelineDecoder/tests/TimelineTests.cpp b/src/timelineDecoder/tests/TimelineTests.cpp index 052a3f12ff..02d93c3caa 100644 --- a/src/timelineDecoder/tests/TimelineTests.cpp +++ b/src/timelineDecoder/tests/TimelineTests.cpp @@ -31,7 +31,6 @@ void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer, offset += uint32_t_size; header[1] = profiling::ReadUint32(packetBuffer, offset); offset += uint32_t_size; - uint32_t PacketDataLength = header[1] & 0x00FFFFFF; auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength); @@ -155,15 +154,14 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTest) TimelineCaptureCommandHandler timelineCaptureCommandHandler( 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, threadIdSize); - BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == ITimelineDecoder::ErrorCode::ErrorCode_Success); - BOOST_CHECK( - timelineDecoder.SetEventClassCallback(PushEventClass) == ITimelineDecoder::ErrorCode::ErrorCode_Success); - BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == ITimelineDecoder::ErrorCode::ErrorCode_Success); - BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == ITimelineDecoder::ErrorCode::ErrorCode_Success); - BOOST_CHECK( - timelineDecoder.SetRelationshipCallback(PushRelationship) == ITimelineDecoder::ErrorCode::ErrorCode_Success); + using Status = ITimelineDecoder::TimelineStatus; + BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success); + BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success); + BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success); + BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success); + BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success); - const uint64_t entityGuid = 111111u ; + const uint64_t entityGuid = 111111u; const uint64_t eventClassGuid = 22222u; const uint64_t timestamp = 33333u; const uint64_t eventGuid = 44444u; |