aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingService.cpp
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2019-08-26 18:28:17 +0100
committerJim Flynn Arm <jim.flynn@arm.com>2019-09-05 16:18:42 +0000
commit02356de9da5d5480b4b9b413d1b6b33daf7ab717 (patch)
tree5ea3b7c7170f34ef5166c50291e213aec6204440 /src/profiling/ProfilingService.cpp
parent0696569fbfb76b485624de24462aaf10d84f415d (diff)
downloadarmnn-02356de9da5d5480b4b9b413d1b6b33daf7ab717.tar.gz
IVGCVSW-3674 Create basic ProfileService class
Signed-off-by: Keith Davis <keith.davis@arm.com> Change-Id: I5bed5196c256883fb704fe14b60bb8f7a77cc9df
Diffstat (limited to 'src/profiling/ProfilingService.cpp')
-rw-r--r--src/profiling/ProfilingService.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
new file mode 100644
index 0000000000..eaaded54d0
--- /dev/null
+++ b/src/profiling/ProfilingService.cpp
@@ -0,0 +1,55 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "ProfilingService.hpp"
+
+namespace armnn
+{
+
+namespace profiling
+{
+
+ProfilingService::ProfilingService(const Runtime::CreationOptions::ExternalProfilingOptions& options)
+ : m_Options(options)
+{
+ Initialise();
+}
+
+void ProfilingService::Initialise()
+{
+ if (m_Options.m_EnableProfiling == true)
+ {
+ // Setup Counter Directory - this should only be created if profiling is enabled
+ // Setup Counter meta
+
+ // For now until CounterDirectory setup is implemented, change m_State once everything initialised
+ m_State.TransitionToState(ProfilingState::NotConnected);
+ }
+}
+
+void ProfilingService::Run()
+{
+ if (m_State.GetCurrentState() == ProfilingState::NotConnected)
+ {
+ // Since GetProfilingConnection is not implemented, if !NULL,
+ // then change to WaitingForAck. This will need to change once there is implementation
+ // for the IProfilingConnection
+ if (!m_Factory.GetProfilingConnection(m_Options))
+ {
+ m_State.TransitionToState(ProfilingState::WaitingForAck);
+ }
+ } else if (m_State.GetCurrentState() == ProfilingState::Uninitialised && m_Options.m_EnableProfiling == true)
+ {
+ Initialise();
+ }
+}
+
+ProfilingState ProfilingService::GetCurrentState() const
+{
+ return m_State.GetCurrentState();
+}
+} // namespace profiling
+
+} // namespace armnn \ No newline at end of file