diff options
author | Jim Flynn <jim.flynn@arm.com> | 2022-03-04 15:03:58 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2022-03-06 19:12:00 +0000 |
commit | 344302581b66677a748a456f370752db75adde21 (patch) | |
tree | 6463b11c70c501e46a2a93d7d57f4f68e4b78cb6 /src/profiling/test | |
parent | 9c315305aaa31a3d1610738cd40f558381f8c687 (diff) | |
download | armnn-344302581b66677a748a456f370752db75adde21.tar.gz |
IVGCVSW-6816 Inject counter registration into ProfilingService
Change-Id: I87ce3a1306eced9fc347cc383d9c7bc8994f0b0c
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/profiling/test')
-rw-r--r-- | src/profiling/test/ProfilingMocks.hpp | 5 | ||||
-rw-r--r-- | src/profiling/test/ProfilingTestUtils.cpp | 9 | ||||
-rw-r--r-- | src/profiling/test/ProfilingTestUtils.hpp | 12 | ||||
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 108 | ||||
-rw-r--r-- | src/profiling/test/ProfilingTests.hpp | 6 | ||||
-rw-r--r-- | src/profiling/test/SendTimelinePacketTests.cpp | 8 | ||||
-rw-r--r-- | src/profiling/test/TimelineUtilityMethodsTests.cpp | 24 |
7 files changed, 118 insertions, 54 deletions
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 93145031ea..ca11ae4348 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -628,9 +628,12 @@ private: class MockProfilingService : public ProfilingService { public: - MockProfilingService(MockBufferManager& mockBufferManager, + MockProfilingService(uint16_t maxGlobalCounterId, + IInitialiseProfilingService& initialiser, + MockBufferManager& mockBufferManager, bool isProfilingEnabled, const CaptureData& captureData) : + ProfilingService(maxGlobalCounterId, initialiser), m_SendCounterPacket(mockBufferManager), m_IsProfilingEnabled(isProfilingEnabled), m_CaptureData(captureData) diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index 154234667e..0d8988c17a 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -3,11 +3,13 @@ // SPDX-License-Identifier: MIT // +#include <ArmNNProfilingServiceInitialiser.hpp> #include "ProfilingOptionsConverter.hpp" #include "ProfilingTestUtils.hpp" #include "ProfilingUtils.hpp" #include <armnn/Descriptors.hpp> +#include <armnn/profiling/ArmNNProfiling.hpp> #include <armnn/utility/Assert.hpp> #include <armnn/utility/NumericCast.hpp> @@ -125,7 +127,8 @@ ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid, } else { - ProfilingService profilingService; + ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); CHECK(readProfilingGuid == profilingService.GetStaticId(label)); } @@ -373,7 +376,9 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) GetProfilingService(&runtime).ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), false); - ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ArmNNProfilingServiceInitialiser initialiser; + ProfilingServiceRuntimeHelper profilingServiceHelper( + arm::pipe::MAX_ARMNN_COUNTER, initialiser, GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp index 32a156ee42..323a762918 100644 --- a/src/profiling/test/ProfilingTestUtils.hpp +++ b/src/profiling/test/ProfilingTestUtils.hpp @@ -71,19 +71,21 @@ namespace pipe class ProfilingServiceRuntimeHelper : public ProfilingService { public: - ProfilingServiceRuntimeHelper(IProfilingService& profilingService) - : m_ProfilingService(profilingService) {} + ProfilingServiceRuntimeHelper(uint16_t maxGlobalCounterId, + IInitialiseProfilingService& initialiser, + arm::pipe::IProfilingService& profilingService) + : ProfilingService(maxGlobalCounterId, initialiser), m_ProfilingService(profilingService) {} ~ProfilingServiceRuntimeHelper() = default; BufferManager& GetProfilingBufferManager() { - return GetBufferManager(static_cast<ProfilingService&>(m_ProfilingService)); + return GetBufferManager(static_cast<arm::pipe::ProfilingService&>(m_ProfilingService)); } - IProfilingService& m_ProfilingService; + arm::pipe::IProfilingService& m_ProfilingService; void ForceTransitionToState(ProfilingState newState) { - TransitionToState(static_cast<ProfilingService&>(m_ProfilingService), newState); + TransitionToState(static_cast<arm::pipe::ProfilingService&>(m_ProfilingService), newState); } }; diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 0a98af2817..fd2670368b 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -3,6 +3,8 @@ // SPDX-License-Identifier: MIT // +#include <ArmNNProfilingServiceInitialiser.hpp> + #include "ProfilingTests.hpp" #include "ProfilingTestUtils.hpp" @@ -18,6 +20,7 @@ #include <ICounterValues.hpp> #include <PeriodicCounterCapture.hpp> #include <PeriodicCounterSelectionCommandHandler.hpp> +#include <armnn/profiling/ArmNNProfiling.hpp> #include <armnn/profiling/ProfilingOptions.hpp> #include <ProfilingStateMachine.hpp> #include <ProfilingUtils.hpp> @@ -657,7 +660,8 @@ TEST_CASE("CaptureDataMethods") TEST_CASE("CheckProfilingServiceDisabled") { ProfilingOptions options; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -667,7 +671,8 @@ TEST_CASE("CheckProfilingServiceDisabled") TEST_CASE("CheckProfilingServiceCounterDirectory") { ProfilingOptions options; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); const ICounterDirectory& counterDirectory0 = profilingService.GetCounterDirectory(); @@ -691,7 +696,8 @@ TEST_CASE("CheckProfilingServiceCounterValues") { ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); profilingService.Update(); @@ -1767,6 +1773,11 @@ TEST_CASE("CounterSelectionCommandHandlerParseData") armnn::IgnoreUnused(counterUid); return true; } + bool IsCounterRegistered(const std::string& counterName) const override + { + armnn::IgnoreUnused(counterName); + return true; + } uint16_t GetCounterCount() const override { return 0; @@ -2007,7 +2018,9 @@ TEST_CASE("CheckProfilingServiceNotActive") options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingServiceRuntimeHelper profilingServiceHelper( + arm::pipe::MAX_ARMNN_COUNTER, initialiser, GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); @@ -2302,7 +2315,11 @@ TEST_CASE("CheckPeriodicCounterCaptureThread") armnn::IgnoreUnused(counterUid); return false; } - + bool IsCounterRegistered(const std::string& counterName) const override + { + armnn::IgnoreUnused(counterName); + return false; + } uint16_t GetCounterCount() const override { return m_CounterSize; @@ -2550,11 +2567,12 @@ TEST_CASE("CheckProfilingServiceGoodConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "WaitingForAck" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2610,11 +2628,12 @@ TEST_CASE("CheckProfilingServiceGoodRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2668,11 +2687,12 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacketInvalidCounterU // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2747,11 +2767,12 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCounters") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2812,11 +2833,12 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketSingleCounter" // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2889,11 +2911,12 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketMultipleCounte // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -2968,11 +2991,12 @@ TEST_CASE("CheckProfilingServiceDisconnect") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Try to disconnect the profiling service while in the "Uninitialised" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3026,11 +3050,12 @@ TEST_CASE("CheckProfilingServiceGoodPerJobCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3093,7 +3118,8 @@ TEST_CASE("CheckConfigureProfilingServiceOn") { ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should get as far as NOT_CONNECTED @@ -3106,7 +3132,8 @@ TEST_CASE("CheckConfigureProfilingServiceOn") TEST_CASE("CheckConfigureProfilingServiceOff") { ProfilingOptions options; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should not move from Uninitialised @@ -3122,7 +3149,8 @@ TEST_CASE("CheckProfilingServiceEnabled") LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3152,7 +3180,8 @@ TEST_CASE("CheckProfilingServiceEnabledRuntime") // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3195,11 +3224,12 @@ TEST_CASE("CheckProfilingServiceBadConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "WaitingForAck" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3257,11 +3287,12 @@ TEST_CASE("CheckProfilingServiceBadRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3321,11 +3352,12 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one - SwapProfilingConnectionFactoryHelper helper(profilingService); + SwapProfilingConnectionFactoryHelper helper(arm::pipe::MAX_ARMNN_COUNTER, initialiser, profilingService); // Bring the profiling service to the "Active" state CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3422,7 +3454,8 @@ TEST_CASE("CheckRegisterBackendCounters") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); RegisterBackendCounters registerBackendCounters(globalCounterIds, cpuRefId, profilingService); @@ -3471,7 +3504,8 @@ TEST_CASE("CheckCounterStatusQuery") options.m_EnableProfiling = true; // Reset the profiling service to the uninitialized state - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); const std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef)); @@ -3609,7 +3643,10 @@ TEST_CASE("CheckRegisterCounters") MockBufferManager mockBuffer(1024); CaptureData captureData; - MockProfilingService mockProfilingService(mockBuffer, options.m_EnableProfiling, captureData); + + armnn::ArmNNProfilingServiceInitialiser initialiser; + MockProfilingService mockProfilingService( + arm::pipe::MAX_ARMNN_COUNTER, initialiser, mockBuffer, options.m_EnableProfiling, captureData); std::string cpuRefId(GetComputeDeviceAsCString(armnn::Compute::CpuRef)); mockProfilingService.RegisterMapping(6, 0, cpuRefId); @@ -3674,7 +3711,8 @@ TEST_CASE("CheckFileFormat") { // Change file format to an unsupported value options.m_FileFormat = "json"; // Enable the profiling service - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); // Start the command handler and the send thread profilingService.Update(); diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp index fd8ad315f1..e1590bd4d9 100644 --- a/src/profiling/test/ProfilingTests.hpp +++ b/src/profiling/test/ProfilingTests.hpp @@ -206,8 +206,10 @@ class SwapProfilingConnectionFactoryHelper : public ProfilingService public: using MockProfilingConnectionFactoryPtr = std::unique_ptr<MockProfilingConnectionFactory>; - SwapProfilingConnectionFactoryHelper(ProfilingService& profilingService) - : ProfilingService() + SwapProfilingConnectionFactoryHelper(uint16_t maxGlobalCounterId, + IInitialiseProfilingService& initialiser, + ProfilingService& profilingService) + : ProfilingService(maxGlobalCounterId, initialiser) , m_ProfilingService(profilingService) , m_MockProfilingConnectionFactory(new MockProfilingConnectionFactory()) , m_BackupProfilingConnectionFactory(nullptr) diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index 4e32149e44..76fa9c1657 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -5,11 +5,13 @@ #include "ProfilingMocks.hpp" +#include <ArmNNProfilingServiceInitialiser.hpp> #include <BufferManager.hpp> #include <ProfilingService.hpp> #include "ProfilingOptionsConverter.hpp" #include <ProfilingUtils.hpp> #include <SendTimelinePacket.hpp> +#include <armnn/profiling/ArmNNProfiling.hpp> #include <armnnUtils/Threads.hpp> #include <TimelinePacketWriterFactory.hpp> @@ -429,7 +431,8 @@ TEST_CASE("GetGuidsFromProfilingService") armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - ProfilingService profilingService(runtime); + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser, runtime); profilingService.ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), true); @@ -450,7 +453,8 @@ TEST_CASE("GetTimelinePackerWriterFromProfilingService") { ProfilingOptions options; options.m_EnableProfiling = true; - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); profilingService.ResetExternalProfilingOptions(options, true); std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket(); diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp index b0b7bff517..0833eb4376 100644 --- a/src/profiling/test/TimelineUtilityMethodsTests.cpp +++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp @@ -6,10 +6,13 @@ #include "ProfilingMocks.hpp" #include "ProfilingTestUtils.hpp" +#include <ArmNNProfilingServiceInitialiser.hpp> #include <SendTimelinePacket.hpp> #include <TimelineUtilityMethods.hpp> #include <ProfilingService.hpp> +#include <armnn/profiling/ArmNNProfiling.hpp> + #include <common/include/LabelsAndEventClasses.hpp> #include <memory> @@ -24,7 +27,8 @@ TEST_SUITE("TimelineUtilityMethodsTests") TEST_CASE("CreateTypedLabelTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); @@ -74,7 +78,8 @@ TEST_CASE("CreateTypedLabelTest") TEST_CASE("SendWellKnownLabelsAndEventClassesTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); SendTimelinePacket sendTimelinePacket(mockBufferManager); CHECK_NOTHROW(TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(sendTimelinePacket)); @@ -201,7 +206,8 @@ TEST_CASE("SendWellKnownLabelsAndEventClassesTest") TEST_CASE("CreateNamedTypedChildEntityTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); @@ -288,7 +294,8 @@ TEST_CASE("CreateNamedTypedChildEntityTest") TEST_CASE("DeclareLabelTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); @@ -317,7 +324,8 @@ TEST_CASE("DeclareLabelTest") TEST_CASE("CreateNameTypeEntityInvalidTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); @@ -342,7 +350,8 @@ TEST_CASE("CreateNameTypeEntityInvalidTest") TEST_CASE("CreateNameTypeEntityTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); @@ -409,7 +418,8 @@ TEST_CASE("CreateNameTypeEntityTest") TEST_CASE("RecordEventTest") { MockBufferManager mockBufferManager(1024); - ProfilingService profilingService; + armnn::ArmNNProfilingServiceInitialiser initialiser; + ProfilingService profilingService(arm::pipe::MAX_ARMNN_COUNTER, initialiser); std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager); TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); // Generate first guid to ensure that the named typed entity guid is not 0 on local single test. |