aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingService.cpp
blob: eaaded54d0e77336d28929b2702d07272eef4039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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