From 3e9bc19ad523361e6b18057849e30c0c48183915 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Wed, 23 Mar 2022 23:01:26 +0000 Subject: IVGCVSW-6706 Create the libpipeClient library Change-Id: I2368aade38ad3808fab55d8a86cd659d4e95d91e Signed-off-by: Jim Flynn --- src/profiling/ProfilingStateMachine.cpp | 95 --------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 src/profiling/ProfilingStateMachine.cpp (limited to 'src/profiling/ProfilingStateMachine.cpp') diff --git a/src/profiling/ProfilingStateMachine.cpp b/src/profiling/ProfilingStateMachine.cpp deleted file mode 100644 index e002c052b9..0000000000 --- a/src/profiling/ProfilingStateMachine.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#include "ProfilingStateMachine.hpp" - -#include - -#include - -namespace arm -{ - -namespace pipe -{ - -namespace -{ - -void ThrowStateTransitionException(ProfilingState expectedState, ProfilingState newState) -{ - std::stringstream ss; - ss << "Cannot transition from state [" << GetProfilingStateName(expectedState) << "] " - << "to state [" << GetProfilingStateName(newState) << "]"; - throw arm::pipe::ProfilingException(ss.str()); -} - -} // Anonymous namespace - -ProfilingState ProfilingStateMachine::GetCurrentState() const -{ - return m_State.load(); -} - -void ProfilingStateMachine::TransitionToState(ProfilingState newState) -{ - ProfilingState currentState = m_State.load(std::memory_order::memory_order_relaxed); - - switch (newState) - { - case ProfilingState::Uninitialised: - do - { - if (!IsOneOfStates(currentState, ProfilingState::Uninitialised)) - { - ThrowStateTransitionException(currentState, newState); - } - } - while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed)); - break; - case ProfilingState::NotConnected: - do - { - if (!IsOneOfStates(currentState, ProfilingState::Uninitialised, ProfilingState::NotConnected, - ProfilingState::Active, ProfilingState::WaitingForAck)) - { - ThrowStateTransitionException(currentState, newState); - } - } - while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed)); - break; - case ProfilingState::WaitingForAck: - do - { - if (!IsOneOfStates(currentState, ProfilingState::NotConnected, ProfilingState::WaitingForAck)) - { - ThrowStateTransitionException(currentState, newState); - } - } - while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed)); - break; - case ProfilingState::Active: - do - { - if (!IsOneOfStates(currentState, ProfilingState::WaitingForAck, ProfilingState::Active)) - { - ThrowStateTransitionException(currentState, newState); - } - } - while (!m_State.compare_exchange_strong(currentState, newState, std::memory_order::memory_order_relaxed)); - break; - default: - break; - } -} - -void ProfilingStateMachine::Reset() -{ - m_State.store(ProfilingState::Uninitialised); -} - -} // namespace pipe - -} // namespace arm -- cgit v1.2.1