blob: 15687a81e9930c5a74909ff9cacccc2edded2d77 [file] [log] [blame]
Narumol Prangnawarat404b2752019-09-24 17:23:16 +01001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
Matteo Martincigh2ffcc412019-11-05 11:47:40 +00008#include <memory>
9
Narumol Prangnawarat404b2752019-09-24 17:23:16 +010010namespace armnn
11{
12
13namespace profiling
14{
15
16class IReadOnlyPacketBuffer // interface used by the read thread
17{
18public:
19 virtual ~IReadOnlyPacketBuffer() {}
20
Matteo Martincigh76c50d82019-11-21 12:10:42 +000021 virtual const unsigned char* GetReadableData() const = 0;
Narumol Prangnawarat404b2752019-09-24 17:23:16 +010022
23 virtual unsigned int GetSize() const = 0;
24
25 virtual void MarkRead() = 0;
26};
27
28class IPacketBuffer : public IReadOnlyPacketBuffer // interface used by code that writes binary packets
29{
30public:
31 virtual ~IPacketBuffer() {}
32
33 virtual void Commit(unsigned int size) = 0;
34
35 virtual void Release() = 0;
36
37 virtual unsigned char* GetWritableData() = 0;
Jim Flynn0204f092020-06-22 20:41:43 +010038
39 /// release the memory held and reset internal point to null.
40 /// After this function is invoked the PacketBuffer is unusable.
41 virtual void Destroy() = 0;
Narumol Prangnawarat404b2752019-09-24 17:23:16 +010042};
43
Matteo Martincigh2ffcc412019-11-05 11:47:40 +000044using IPacketBufferPtr = std::unique_ptr<IPacketBuffer>;
45
Narumol Prangnawarat404b2752019-09-24 17:23:16 +010046} // namespace profiling
47
Matteo Martincigh2ffcc412019-11-05 11:47:40 +000048} // namespace armnn