diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-09-05 12:02:04 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-09-09 16:47:56 +0000 |
commit | ab173e9b6978d5befb4884a803773967d52bcfef (patch) | |
tree | 1e632b4a8db54dc2051a2810ec485dd6b75755c1 /src/profiling/test/ProfilingTests.cpp | |
parent | 149528e88c081e71fc7ec78e0c301eb2e487adfc (diff) | |
download | armnn-ab173e9b6978d5befb4884a803773967d52bcfef.tar.gz |
IVGCVSW-3691 Add utility function to generate valid UIDs for profiling objects
Change-Id: I59ad320bfd52c881671c5e4710fb70c5d0293aad
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index eda45e8640..fe94092c7f 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -11,7 +11,7 @@ #include "../Packet.hpp" #include "../PacketVersionResolver.hpp" #include "../ProfilingStateMachine.hpp" - +#include "../ProfilingUtils.hpp" #include "../ProfilingService.hpp" #include <boost/test/unit_test.hpp> @@ -502,4 +502,30 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceEnabledRuntime) BOOST_CHECK(service.GetCurrentState() == ProfilingState::WaitingForAck); } +void GetNextUidTestImpl(uint16_t& outUid) +{ + outUid = GetNextUid(); +} + +BOOST_AUTO_TEST_CASE(GetNextUidTest) +{ + uint16_t uid0 = 0; + uint16_t uid1 = 0; + uint16_t uid2 = 0; + + std::thread thread1(GetNextUidTestImpl, std::ref(uid0)); + std::thread thread2(GetNextUidTestImpl, std::ref(uid1)); + std::thread thread3(GetNextUidTestImpl, std::ref(uid2)); + thread1.join(); + thread2.join(); + thread3.join(); + + BOOST_TEST(uid0 > 0); + BOOST_TEST(uid1 > 0); + BOOST_TEST(uid2 > 0); + BOOST_TEST(uid0 != uid1); + BOOST_TEST(uid0 != uid2); + BOOST_TEST(uid1 != uid2); +} + BOOST_AUTO_TEST_SUITE_END() |