aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingService.cpp
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2019-10-15 10:18:11 +0100
committerJim Flynn Arm <jim.flynn@arm.com>2019-10-15 14:43:37 +0000
commit672d06eac5b0842c22f9f219e9b65efcd5883d33 (patch)
tree7961c81d0073d9e49491c26e67586cfa1a0aae6c /src/profiling/ProfilingService.cpp
parent062e0e95a4332430efa7b0d5af3aab7a5b45a2dc (diff)
downloadarmnn-672d06eac5b0842c22f9f219e9b65efcd5883d33.tar.gz
IVGCVSW-3948 Add Startup method to Profiling
Change-Id: I591e84048775278bfc728e1b0c189ff4cf2d350b Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/profiling/ProfilingService.cpp')
-rw-r--r--src/profiling/ProfilingService.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index b481695d49..b87773fc86 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -28,6 +28,56 @@ void ProfilingService::ResetExternalProfilingOptions(const ExternalProfilingOpti
}
}
+ProfilingState ProfilingService::ConfigureProfilingService(
+ const ExternalProfilingOptions& options,
+ bool resetProfilingService)
+{
+ ResetExternalProfilingOptions(options, resetProfilingService);
+ ProfilingState currentState = m_StateMachine.GetCurrentState();
+ if (options.m_EnableProfiling)
+ {
+ switch (currentState)
+ {
+ case ProfilingState::Uninitialised:
+ Update(); // should transition to NotConnected
+ Update(); // will either stay in NotConnected because there is no server
+ // or will enter WaitingForAck.
+ currentState = m_StateMachine.GetCurrentState();
+ if (currentState == ProfilingState::WaitingForAck)
+ {
+ Update(); // poke it again to send out the metadata packet
+ }
+ currentState = m_StateMachine.GetCurrentState();
+ return currentState;
+ case ProfilingState::NotConnected:
+ Update(); // will either stay in NotConnected because there is no server
+ // or will enter WaitingForAck
+ currentState = m_StateMachine.GetCurrentState();
+ if (currentState == ProfilingState::WaitingForAck)
+ {
+ Update(); // poke it again to send out the metadata packet
+ }
+ currentState = m_StateMachine.GetCurrentState();
+ return currentState;
+ default:
+ return currentState;
+ }
+ }
+ else
+ {
+ // Make sure profiling is shutdown
+ switch (currentState)
+ {
+ case ProfilingState::Uninitialised:
+ case ProfilingState::NotConnected:
+ return currentState;
+ default:
+ Stop();
+ return m_StateMachine.GetCurrentState();
+ }
+ }
+}
+
void ProfilingService::Update()
{
if (!m_Options.m_EnableProfiling)