aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp
blob: 645b0b3507d6e4aa83b5ac55347312d250fadec7 (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
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "PeriodicCounterSelectionResponseHandler.hpp"

#include "../../../src/profiling/ProfilingUtils.hpp"

#include <iostream>

namespace armnn
{

namespace gatordmock
{

void PeriodicCounterSelectionResponseHandler::operator()(const profiling::Packet& packet)
{
    if (!m_QuietOperation)    // Are we supposed to print to stdout?
    {
        uint32_t period = profiling::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), 0);
        uint32_t numCounters = 0;
        // First check if there are any counters mentioned.
        if(packet.GetLength() > 4)
        {
            // Length will be 4 bytes for the period and then a list of 16 bit UIDS.
            numCounters = ((packet.GetLength() - 4) / 2);
        }
        std::cout << "PeriodicCounterSelectionResponse: Collection interval = " << std::dec << period << "uSec"
                  << " Num counters activated = " << numCounters << std::endl;
    }
}

}    // namespace gatordmock

}    // namespace armnn