diff options
author | Jim Flynn <jim.flynn@arm.com> | 2019-10-25 13:17:30 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-10-28 16:29:22 +0000 |
commit | ab84575629b4836ce592ea77831225ce5bbe676f (patch) | |
tree | a756383845ba3a936699adae858b88896f96feed /src/profiling/test | |
parent | d6f26fc022defe1f6220bb6e2874fefc9a4c0cba (diff) | |
download | armnn-ab84575629b4836ce592ea77831225ce5bbe676f.tar.gz |
IVGCVSW-4031 Provide well known profiling GUIDs
Change-Id: Ibf99b025f51503e8937012b655aad74698f32e38
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/profiling/test')
-rw-r--r-- | src/profiling/test/SendTimelinePacketTests.cpp | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index 9b144bb3d3..53e52b5b5b 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -12,6 +12,9 @@ #include <TimelinePacketWriterFactory.hpp> #include <boost/test/unit_test.hpp> +#include <LabelsAndEventClasses.hpp> + +#include <functional> using namespace armnn::profiling; @@ -392,14 +395,16 @@ BOOST_AUTO_TEST_CASE(GetGuidsFromProfilingService) ProfilingService& profilingService = ProfilingService::Instance(); profilingService.ResetExternalProfilingOptions(options, true); ProfilingStaticGuid staticGuid = profilingService.GenerateStaticId("dummy"); - // TODO when actual value gets generated verify its correctness - ProfilingStaticGuid expectedStaticValue(0); + // TODO this will change again... + std::hash<std::string> hasher; + uint64_t hash = static_cast<uint64_t>(hasher("dummy")); + ProfilingStaticGuid expectedStaticValue(hash); BOOST_CHECK(staticGuid == expectedStaticValue); ProfilingDynamicGuid dynamicGuid = profilingService.NextGuid(); - // TODO when actual value gets generated verify its correctness by verifying - // it is in the correct range i.e. > x and that if NextGuid is invoked - // again it is equal to the previous + 1 - ProfilingDynamicGuid expectedDynamicValue(0); + uint64_t dynamicGuidValue = static_cast<uint64_t>(dynamicGuid); + ++dynamicGuidValue; + ProfilingDynamicGuid expectedDynamicValue(dynamicGuidValue); + dynamicGuid = profilingService.NextGuid(); BOOST_CHECK(dynamicGuid == expectedDynamicValue); } @@ -414,4 +419,33 @@ BOOST_AUTO_TEST_CASE(GetTimelinePackerWriterFromProfilingService) BOOST_CHECK(writer != nullptr); } +BOOST_AUTO_TEST_CASE(CheckStaticGuidsAndEvents) +{ + BOOST_CHECK("name" == LabelsAndEventClasses::NAME_LABEL); + BOOST_CHECK("type" == LabelsAndEventClasses::TYPE_LABEL); + BOOST_CHECK("index" == LabelsAndEventClasses::INDEX_LABEL); + + std::hash<std::string> hasher; + + uint64_t hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::NAME_LABEL)); + ProfilingStaticGuid expectedNameGuid(hash); + BOOST_CHECK(LabelsAndEventClasses::NAME_GUID == expectedNameGuid); + + hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::TYPE_LABEL)); + ProfilingStaticGuid expectedTypeGuid(hash); + BOOST_CHECK(LabelsAndEventClasses::TYPE_GUID == expectedTypeGuid); + + hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::INDEX_LABEL)); + ProfilingStaticGuid expectedIndexGuid(hash); + BOOST_CHECK(LabelsAndEventClasses::INDEX_GUID == expectedIndexGuid); + + hash = static_cast<uint64_t>(hasher("ARMNN_PROFILING_SOL")); + ProfilingStaticGuid expectedSol(hash); + BOOST_CHECK(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS == expectedSol); + + hash = static_cast<uint64_t>(hasher("ARMNN_PROFILING_EOL")); + ProfilingStaticGuid expectedEol(hash); + BOOST_CHECK(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS == expectedEol); +} + BOOST_AUTO_TEST_SUITE_END() |