diff options
author | FinnWilliamsArm <Finn.Williams@arm.com> | 2019-09-16 15:45:42 +0100 |
---|---|---|
committer | Jim Flynn Arm <jim.flynn@arm.com> | 2019-09-25 05:28:48 +0000 |
commit | f6e534a82d167403c5980e3ea3b67135ff9be78b (patch) | |
tree | 1d355ea0c6e9d2c42836c0a378f4cc10978abf6c /src/profiling/test/ProfilingTests.cpp | |
parent | 95e73d77b9a79f7d350a39d85f07d09cd58422cc (diff) | |
download | armnn-f6e534a82d167403c5980e3ea3b67135ff9be78b.tar.gz |
IVGCVSW-3411 Add the Counter Values array and accessor methods
Signed-off-by: FinnWilliamsArm <Finn.Williams@arm.com>
Change-Id: I4fa2428a83b93cbe58b821344206e2f7ce9e37e7
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 48723dbc34..b90d469424 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -702,6 +702,38 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterDirectory) BOOST_CHECK(counterDirectory1.GetCounterCount() != 0); } +BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterValues) +{ + armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + options.m_EnableProfiling = true; + ProfilingService profilingService(options); + + ProfilingService* profilingServicePtr = &profilingService; + std::vector<std::thread> writers; + + for(int i = 0; i < 100 ; ++i) + { + // Increment and decrement counter 0 + writers.push_back(std::thread(&ProfilingService::IncrementCounterValue, profilingServicePtr, 0)); + writers.push_back(std::thread(&ProfilingService::DecrementCounterValue, profilingServicePtr, 0)); + // Add 10 to counter 0 and subtract 5 from counter 0 + writers.push_back(std::thread(&ProfilingService::AddCounterValue, profilingServicePtr, 0, 10)); + writers.push_back(std::thread(&ProfilingService::SubtractCounterValue, profilingServicePtr, 0, 5)); + } + + std::for_each(writers.begin(), writers.end(), mem_fn(&std::thread::join)); + + uint32_t counterValue; + profilingService.GetCounterValue(0, counterValue); + BOOST_CHECK(counterValue == 500); + + profilingService.SetCounterValue(0, 0); + profilingService.GetCounterValue(0, counterValue); + BOOST_CHECK(counterValue == 0); + + BOOST_CHECK_THROW(profilingService.SetCounterValue(profilingService.GetCounterCount(), 1), armnn::Exception); +} + BOOST_AUTO_TEST_CASE(CheckProfilingObjectUids) { uint16_t uid = 0; |