| 388 | } |
| 389 | |
| 390 | void ProfilingService::Stop() |
| 391 | { |
| 392 | #if !defined(ARMNN_STUB_PROFILING) |
| 393 | { // only lock when we are updating the inference completed variable |
| 394 | std::unique_lock<std::mutex> lck(m_ServiceActiveMutex); |
| 395 | m_ServiceActive = false; |
| 396 | } |
| 397 | // The order in which we reset/stop the components is not trivial! |
| 398 | // First stop the producing threads |
| 399 | // Command Handler first as it is responsible for launching then Periodic Counter capture thread |
| 400 | m_CommandHandler.Stop(); |
| 401 | m_PeriodicCounterCapture.Stop(); |
| 402 | // The the consuming thread |
| 403 | m_SendThread.Stop(false); |
| 404 | |
| 405 | // ...then close and destroy the profiling connection... |
| 406 | if (m_ProfilingConnection != nullptr && m_ProfilingConnection->IsOpen()) |
| 407 | { |
| 408 | m_ProfilingConnection->Close(); |
| 409 | } |
| 410 | m_ProfilingConnection.reset(); |
| 411 | |
| 412 | // ...then move to the "NotConnected" state |
| 413 | m_StateMachine.TransitionToState(ProfilingState::NotConnected); |
| 414 | #endif // ARMNN_STUB_PROFILING |
| 415 | } |
| 416 | |
| 417 | inline void ProfilingService::CheckCounterUid(uint16_t counterUid) const |
| 418 | { |
no test coverage detected