• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "IProfilingConnection.hpp"
7 
8 #include <common/include/NetworkSockets.hpp>
9 
10 #pragma once
11 
12 namespace arm
13 {
14 namespace pipe
15 {
16 
17 class SocketProfilingConnection : public IProfilingConnection
18 {
19 public:
20     SocketProfilingConnection();
21     bool IsOpen() const final;
22     void Close() final;
23     bool WritePacket(const unsigned char* buffer, uint32_t length) final;
24     arm::pipe::Packet ReadPacket(uint32_t timeout) final;
25 
26 private:
27 
28     // Read a full packet from the socket.
29     arm::pipe::Packet ReceivePacket();
30 
31 #ifndef __APPLE__
32     // To indicate we want to use an abstract UDS ensure the first character of the address is 0.
33     const char* m_GatorNamespace = "\0gatord_namespace";
34 #else
35     // MACOSX does not support abstract UDS
36     const char* m_GatorNamespace = "/tmp/gatord_namespace";
37 #endif
38 #if !defined(ARMNN_DISABLE_SOCKETS)
39     arm::pipe::PollFd m_Socket[1]{};
40 #endif
41 };
42 
43 } // namespace pipe
44 } // namespace arm
45