From 3184c907b2420e6c66485529f336251b2b62aecf Mon Sep 17 00:00:00 2001 From: Sadik Armagan Date: Wed, 18 Mar 2020 10:57:30 +0000 Subject: IVGCVSW-4463 Change ProfilingService to a member of runtime from a singleton Signed-off-by: Sadik Armagan Change-Id: I345c39a10a4693a500aa1687d9a5cee76da791c3 --- .../backendsCommon/test/BackendProfilingTests.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/backends/backendsCommon/test/BackendProfilingTests.cpp') diff --git a/src/backends/backendsCommon/test/BackendProfilingTests.cpp b/src/backends/backendsCommon/test/BackendProfilingTests.cpp index b9e0e45c0a..1cf67c016d 100644 --- a/src/backends/backendsCommon/test/BackendProfilingTests.cpp +++ b/src/backends/backendsCommon/test/BackendProfilingTests.cpp @@ -14,6 +14,8 @@ #include "ProfilingUtils.hpp" #include "RequestCounterDirectoryCommandHandler.hpp" +#include + #include #include #include @@ -113,17 +115,16 @@ BOOST_AUTO_TEST_CASE(BackendProfilingCounterRegisterMockBackendTest) { // Reset the profiling service to the uninitialized state armnn::IRuntime::CreationOptions options; - options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance(); - profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true); + options.m_ProfilingOptions.m_EnableProfiling = true;; armnn::MockBackendInitialiser initialiser; // Create a runtime - armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); +// armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); + armnn::Runtime runtime(options); // Check if the MockBackends 3 dummy counters {0, 1, 2-5 (four cores)} are registered armnn::BackendId mockId = armnn::MockBackendId(); - const armnn::profiling::ICounterMappings& counterMap = profilingService.GetCounterMappings(); + const armnn::profiling::ICounterMappings& counterMap = GetProfilingService(&runtime).GetCounterMappings(); BOOST_CHECK(counterMap.GetGlobalId(0, mockId) == 5); BOOST_CHECK(counterMap.GetGlobalId(1, mockId) == 6); BOOST_CHECK(counterMap.GetGlobalId(2, mockId) == 7); @@ -131,7 +132,7 @@ BOOST_AUTO_TEST_CASE(BackendProfilingCounterRegisterMockBackendTest) BOOST_CHECK(counterMap.GetGlobalId(4, mockId) == 9); BOOST_CHECK(counterMap.GetGlobalId(5, mockId) == 10); options.m_ProfilingOptions.m_EnableProfiling = false; - profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true); + GetProfilingService(&runtime).ResetExternalProfilingOptions(options.m_ProfilingOptions, true); } BOOST_AUTO_TEST_CASE(TestBackendCounters) @@ -149,7 +150,7 @@ BOOST_AUTO_TEST_CASE(TestBackendCounters) armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance(); + armnn::profiling::ProfilingService profilingService; std::unique_ptr cpuBackendProfilingPtr = std::make_unique(options, profilingService, cpuAccId); @@ -397,7 +398,7 @@ BOOST_AUTO_TEST_CASE(TestBackendCounterLogging) armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance(); + armnn::profiling::ProfilingService profilingService; std::unique_ptr cpuBackendProfilingPtr = std::make_unique(options, profilingService, cpuAccId); @@ -449,7 +450,7 @@ BOOST_AUTO_TEST_CASE(BackendProfilingContextGetSendTimelinePacket) // Reset the profiling service to the uninitialized state armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance(); + armnn::profiling::ProfilingService profilingService; profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true); armnn::MockBackendInitialiser initialiser; @@ -482,8 +483,6 @@ BOOST_AUTO_TEST_CASE(GetProfilingGuidGenerator) // Reset the profiling service to the uninitialized state armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance(); - profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true); armnn::MockBackendInitialiser initialiser; // Create a runtime. During this the mock backend will be registered and context returned. @@ -506,7 +505,6 @@ BOOST_AUTO_TEST_CASE(GetProfilingGuidGenerator) // Reset the profiling servie after the test. options.m_ProfilingOptions.m_EnableProfiling = false; - profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true); } BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.1