aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingStateMachine.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-02 12:50:57 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-08 15:53:43 +0100
commit54fb957c9640d61ab575d7acfc4c430a15123315 (patch)
tree51ce829032913af068071be0dcfff7c7bef409b7 /src/profiling/ProfilingStateMachine.cpp
parentc4728ad356b73915588c971f6de38f4493078397 (diff)
downloadarmnn-54fb957c9640d61ab575d7acfc4c430a15123315.tar.gz
IVGCVSW-3937 Add the necessary components to the ProfilingService class to
process a connection to an external profiling service (e.g. gatord) * Added the required components (CommandHandlerRegistry, CommandHandler, SendCounterPacket, ...) to the ProfilingService class * Reworked the ProfilingService::Run procedure and renamed it to Update * Handling all states but Active in the Run method (future work) * Updated the unit and tests accordingly * Added component tests to check that the Connection Acknowledged packet is handled correctly * Added test util classes, made the default constructor/destructor protected to superclass a ProfilingService object * Added IProfilingConnectionFactory interface Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I010d94b18980c9e6394253f4b2bbe4fe5bb3fe4f
Diffstat (limited to 'src/profiling/ProfilingStateMachine.cpp')
-rw-r--r--src/profiling/ProfilingStateMachine.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/profiling/ProfilingStateMachine.cpp b/src/profiling/ProfilingStateMachine.cpp
index 5af5bfbed0..9d3a81f64a 100644
--- a/src/profiling/ProfilingStateMachine.cpp
+++ b/src/profiling/ProfilingStateMachine.cpp
@@ -35,50 +35,50 @@ ProfilingState ProfilingStateMachine::GetCurrentState() const
void ProfilingStateMachine::TransitionToState(ProfilingState newState)
{
- ProfilingState expectedState = m_State.load(std::memory_order::memory_order_relaxed);
+ ProfilingState currentState = m_State.load(std::memory_order::memory_order_relaxed);
switch (newState)
{
case ProfilingState::Uninitialised:
do
{
- if (!IsOneOfStates(expectedState, ProfilingState::Uninitialised))
+ if (!IsOneOfStates(currentState, ProfilingState::Uninitialised))
{
- ThrowStateTransitionException(expectedState, newState);
+ ThrowStateTransitionException(currentState, newState);
}
}
- while (!m_State.compare_exchange_strong(expectedState, newState, std::memory_order::memory_order_relaxed));
+ while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed));
break;
case ProfilingState::NotConnected:
do
{
- if (!IsOneOfStates(expectedState, ProfilingState::Uninitialised, ProfilingState::NotConnected,
+ if (!IsOneOfStates(currentState, ProfilingState::Uninitialised, ProfilingState::NotConnected,
ProfilingState::Active))
{
- ThrowStateTransitionException(expectedState, newState);
+ ThrowStateTransitionException(currentState, newState);
}
}
- while (!m_State.compare_exchange_strong(expectedState, newState, std::memory_order::memory_order_relaxed));
+ while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed));
break;
case ProfilingState::WaitingForAck:
do
{
- if (!IsOneOfStates(expectedState, ProfilingState::NotConnected, ProfilingState::WaitingForAck))
+ if (!IsOneOfStates(currentState, ProfilingState::NotConnected, ProfilingState::WaitingForAck))
{
- ThrowStateTransitionException(expectedState, newState);
+ ThrowStateTransitionException(currentState, newState);
}
}
- while (!m_State.compare_exchange_strong(expectedState, newState, std::memory_order::memory_order_relaxed));
+ while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed));
break;
case ProfilingState::Active:
do
{
- if (!IsOneOfStates(expectedState, ProfilingState::WaitingForAck, ProfilingState::Active))
+ if (!IsOneOfStates(currentState, ProfilingState::WaitingForAck, ProfilingState::Active))
{
- ThrowStateTransitionException(expectedState, newState);
+ ThrowStateTransitionException(currentState, newState);
}
}
- while (!m_State.compare_exchange_strong(expectedState, newState, std::memory_order::memory_order_relaxed));
+ while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed));
break;
default:
break;