Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 6 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 8 | <title>ArmNN: SocketProfilingConnection Class Reference</title> |
| 9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 10 | <script type="text/javascript" src="jquery.js"></script> |
| 11 | <script type="text/javascript" src="dynsections.js"></script> |
| 12 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 13 | <script type="text/javascript" src="resize.js"></script> |
| 14 | <script type="text/javascript" src="navtreedata.js"></script> |
| 15 | <script type="text/javascript" src="navtree.js"></script> |
| 16 | <script type="text/javascript"> |
| 17 | $(document).ready(initResizable); |
| 18 | </script> |
| 19 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 20 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 21 | <script type="text/javascript" src="search/search.js"></script> |
| 22 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 23 | </head> |
| 24 | <body> |
| 25 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 26 | <div id="titlearea"> |
| 27 | <table cellspacing="0" cellpadding="0"> |
| 28 | <tbody> |
| 29 | <tr style="height: 56px;"> |
| 30 | <td id="projectalign" style="padding-left: 0.5em;"> |
| 31 | <div id="projectname">ArmNN |
| 32 |  <span id="projectnumber">NotReleased</span> |
| 33 | </div> |
| 34 | </td> |
| 35 | </tr> |
| 36 | </tbody> |
| 37 | </table> |
| 38 | </div> |
| 39 | <!-- end header part --> |
| 40 | <!-- Generated by Doxygen 1.8.13 --> |
| 41 | <script type="text/javascript"> |
| 42 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 43 | </script> |
| 44 | <script type="text/javascript" src="menudata.js"></script> |
| 45 | <script type="text/javascript" src="menu.js"></script> |
| 46 | <script type="text/javascript"> |
| 47 | $(function() { |
| 48 | initMenu('',true,false,'search.php','Search'); |
| 49 | $(document).ready(function() { init_search(); }); |
| 50 | }); |
| 51 | </script> |
| 52 | <div id="main-nav"></div> |
| 53 | </div><!-- top --> |
| 54 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 55 | <div id="nav-tree"> |
| 56 | <div id="nav-tree-contents"> |
| 57 | <div id="nav-sync" class="sync"></div> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div id="splitbar" style="-moz-user-select:none;" |
| 61 | class="ui-resizable-handle"> |
| 62 | </div> |
| 63 | </div> |
| 64 | <script type="text/javascript"> |
| 65 | $(document).ready(function(){initNavTree('classarmnn_1_1profiling_1_1_socket_profiling_connection.html','');}); |
| 66 | </script> |
| 67 | <div id="doc-content"> |
| 68 | <!-- window showing the filter options --> |
| 69 | <div id="MSearchSelectWindow" |
| 70 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 71 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 72 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 73 | </div> |
| 74 | |
| 75 | <!-- iframe showing the search results (closed by default) --> |
| 76 | <div id="MSearchResultsWindow"> |
| 77 | <iframe src="javascript:void(0)" frameborder="0" |
| 78 | name="MSearchResults" id="MSearchResults"> |
| 79 | </iframe> |
| 80 | </div> |
| 81 | |
| 82 | <div class="header"> |
| 83 | <div class="summary"> |
| 84 | <a href="#pub-methods">Public Member Functions</a> | |
| 85 | <a href="classarmnn_1_1profiling_1_1_socket_profiling_connection-members.html">List of all members</a> </div> |
| 86 | <div class="headertitle"> |
| 87 | <div class="title">SocketProfilingConnection Class Reference</div> </div> |
| 88 | </div><!--header--> |
| 89 | <div class="contents"> |
| 90 | |
| 91 | <p><code>#include <<a class="el" href="_socket_profiling_connection_8hpp_source.html">SocketProfilingConnection.hpp</a>></code></p> |
| 92 | <div class="dynheader"> |
| 93 | Inheritance diagram for SocketProfilingConnection:</div> |
| 94 | <div class="dyncontent"> |
| 95 | <div class="center"> |
| 96 | <img src="classarmnn_1_1profiling_1_1_socket_profiling_connection.png" usemap="#SocketProfilingConnection_map" alt=""/> |
| 97 | <map id="SocketProfilingConnection_map" name="SocketProfilingConnection_map"> |
| 98 | <area href="classarmnn_1_1profiling_1_1_i_profiling_connection.html" alt="IProfilingConnection" shape="rect" coords="0,0,161,24"/> |
| 99 | </map> |
| 100 | </div></div> |
| 101 | <table class="memberdecls"> |
| 102 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> |
| 103 | Public Member Functions</h2></td></tr> |
| 104 | <tr class="memitem:aba0a393ed98758e76bd30d2862e0740e"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#aba0a393ed98758e76bd30d2862e0740e">SocketProfilingConnection</a> ()</td></tr> |
| 105 | <tr class="separator:aba0a393ed98758e76bd30d2862e0740e"><td class="memSeparator" colspan="2"> </td></tr> |
| 106 | <tr class="memitem:aaca9d54975c036540e7e5299a0c6df7a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#aaca9d54975c036540e7e5299a0c6df7a">IsOpen</a> () const final</td></tr> |
| 107 | <tr class="separator:aaca9d54975c036540e7e5299a0c6df7a"><td class="memSeparator" colspan="2"> </td></tr> |
| 108 | <tr class="memitem:a29dc6798f18d73abd4ba8e4910f6831f"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">Close</a> () final</td></tr> |
| 109 | <tr class="separator:a29dc6798f18d73abd4ba8e4910f6831f"><td class="memSeparator" colspan="2"> </td></tr> |
| 110 | <tr class="memitem:a096549d574d3fc51e6948efd24988f3e"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a096549d574d3fc51e6948efd24988f3e">WritePacket</a> (const unsigned char *buffer, uint32_t length) final</td></tr> |
| 111 | <tr class="separator:a096549d574d3fc51e6948efd24988f3e"><td class="memSeparator" colspan="2"> </td></tr> |
| 112 | <tr class="memitem:a15c46007b7627c887593d267023fbfa4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classarmnn_1_1profiling_1_1_packet.html">Packet</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a15c46007b7627c887593d267023fbfa4">ReadPacket</a> (uint32_t timeout) final</td></tr> |
| 113 | <tr class="separator:a15c46007b7627c887593d267023fbfa4"><td class="memSeparator" colspan="2"> </td></tr> |
| 114 | <tr class="inherit_header pub_methods_classarmnn_1_1profiling_1_1_i_profiling_connection"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classarmnn_1_1profiling_1_1_i_profiling_connection')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html">IProfilingConnection</a></td></tr> |
| 115 | <tr class="memitem:a8c5a75b8ee005a7aa9391f3991480d74 inherit pub_methods_classarmnn_1_1profiling_1_1_i_profiling_connection"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html#a8c5a75b8ee005a7aa9391f3991480d74">~IProfilingConnection</a> ()</td></tr> |
| 116 | <tr class="separator:a8c5a75b8ee005a7aa9391f3991480d74 inherit pub_methods_classarmnn_1_1profiling_1_1_i_profiling_connection"><td class="memSeparator" colspan="2"> </td></tr> |
| 117 | </table> |
| 118 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 119 | <div class="textblock"> |
| 120 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8hpp_source.html#l00018">18</a> of file <a class="el" href="_socket_profiling_connection_8hpp_source.html">SocketProfilingConnection.hpp</a>.</p> |
| 121 | </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> |
| 122 | <a id="aba0a393ed98758e76bd30d2862e0740e"></a> |
| 123 | <h2 class="memtitle"><span class="permalink"><a href="#aba0a393ed98758e76bd30d2862e0740e">◆ </a></span>SocketProfilingConnection()</h2> |
| 124 | |
| 125 | <div class="memitem"> |
| 126 | <div class="memproto"> |
| 127 | <table class="memname"> |
| 128 | <tr> |
| 129 | <td class="memname"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html">SocketProfilingConnection</a> </td> |
| 130 | <td>(</td> |
| 131 | <td class="paramname"></td><td>)</td> |
| 132 | <td></td> |
| 133 | </tr> |
| 134 | </table> |
| 135 | </div><div class="memdoc"> |
| 136 | |
| 137 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00019">19</a> of file <a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a>.</p> |
| 138 | |
| 139 | <p class="reference">References <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00058">SocketProfilingConnection::Close()</a>, <a class="el" href="_network_sockets_8cpp_source.html#l00018">armnnUtils::Sockets::Initialize()</a>, and <a class="el" href="_network_sockets_8cpp_source.html#l00038">armnnUtils::Sockets::SetNonBlocking()</a>.</p> |
| 140 | <div class="fragment"><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <a class="code" href="namespacearmnn_utils_1_1_sockets.html#a248c764067ee60c03ee370784c49f353">Sockets::Initialize</a>();</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  memset(m_Socket, 0, <span class="keyword">sizeof</span>(m_Socket));</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="comment">// Note: we're using Linux specific SOCK_CLOEXEC flag.</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  m_Socket[0].fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="keywordflow">if</span> (m_Socket[0].fd == -1)</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  {</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Socket construction failed: "</span>) + strerror(errno));</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  }</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="comment">// Connect to the named unix domain socket.</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  sockaddr_un server{};</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  memset(&server, 0, <span class="keyword">sizeof</span>(sockaddr_un));</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="comment">// As m_GatorNamespace begins with a null character we need to ignore that when getting its length.</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  memcpy(server.sun_path, m_GatorNamespace, strlen(m_GatorNamespace + 1) + 1);</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  server.sun_family = AF_UNIX;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">if</span> (0 != connect(m_Socket[0].fd, reinterpret_cast<const sockaddr*>(&server), <span class="keyword">sizeof</span>(sockaddr_un)))</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  {</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <a class="code" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">Close</a>();</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Cannot connect to stream socket: "</span>) + strerror(errno));</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  }</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">// Our socket will only be interested in polling reads.</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  m_Socket[0].events = POLLIN;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="comment">// Make the socket non blocking.</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keywordflow">if</span> (!<a class="code" href="namespacearmnn_utils_1_1_sockets.html#a8396c0d14fc0e7284b175fedfeceef37">Sockets::SetNonBlocking</a>(m_Socket[0].fd))</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  {</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <a class="code" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">Close</a>();</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Failed to set socket as non blocking: "</span>) + strerror(errno));</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  }</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> }</div><div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_a248c764067ee60c03ee370784c49f353"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#a248c764067ee60c03ee370784c49f353">armnnUtils::Sockets::Initialize</a></div><div class="ttdeci">bool Initialize()</div><div class="ttdoc">Performs any required one-time setup. </div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00018">NetworkSockets.cpp:18</a></div></div> |
| 141 | <div class="ttc" id="classarmnn_1_1profiling_1_1_socket_profiling_connection_html_a29dc6798f18d73abd4ba8e4910f6831f"><div class="ttname"><a href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">armnn::profiling::SocketProfilingConnection::Close</a></div><div class="ttdeci">void Close() final</div><div class="ttdef"><b>Definition:</b> <a href="_socket_profiling_connection_8cpp_source.html#l00058">SocketProfilingConnection.cpp:58</a></div></div> |
| 142 | <div class="ttc" id="classarmnn_1_1_runtime_exception_html"><div class="ttname"><a href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00120">Exceptions.hpp:120</a></div></div> |
| 143 | <div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_a8396c0d14fc0e7284b175fedfeceef37"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#a8396c0d14fc0e7284b175fedfeceef37">armnnUtils::Sockets::SetNonBlocking</a></div><div class="ttdeci">bool SetNonBlocking(Socket s)</div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00038">NetworkSockets.cpp:38</a></div></div> |
| 144 | </div><!-- fragment --> |
| 145 | </div> |
| 146 | </div> |
| 147 | <h2 class="groupheader">Member Function Documentation</h2> |
| 148 | <a id="a29dc6798f18d73abd4ba8e4910f6831f"></a> |
| 149 | <h2 class="memtitle"><span class="permalink"><a href="#a29dc6798f18d73abd4ba8e4910f6831f">◆ </a></span>Close()</h2> |
| 150 | |
| 151 | <div class="memitem"> |
| 152 | <div class="memproto"> |
| 153 | <table class="mlabels"> |
| 154 | <tr> |
| 155 | <td class="mlabels-left"> |
| 156 | <table class="memname"> |
| 157 | <tr> |
| 158 | <td class="memname">void Close </td> |
| 159 | <td>(</td> |
| 160 | <td class="paramname"></td><td>)</td> |
| 161 | <td></td> |
| 162 | </tr> |
| 163 | </table> |
| 164 | </td> |
| 165 | <td class="mlabels-right"> |
| 166 | <span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span> </td> |
| 167 | </tr> |
| 168 | </table> |
| 169 | </div><div class="memdoc"> |
| 170 | |
| 171 | <p>Implements <a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html#aacb6d0e5e6d570cdc2b0da14c3921ff0">IProfilingConnection</a>.</p> |
| 172 | |
| 173 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00058">58</a> of file <a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a>.</p> |
| 174 | |
| 175 | <p class="reference">References <a class="el" href="_network_sockets_8cpp_source.html#l00028">armnnUtils::Sockets::Close()</a>.</p> |
| 176 | |
| 177 | <p class="reference">Referenced by <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00078">SocketProfilingConnection::ReadPacket()</a>, and <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00019">SocketProfilingConnection::SocketProfilingConnection()</a>.</p> |
| 178 | <div class="fragment"><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">if</span> (<a class="code" href="namespacearmnn_utils_1_1_sockets.html#a72e0661331d20d0a352fb49c388a1b05">Sockets::Close</a>(m_Socket[0].fd) != 0)</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Cannot close stream socket: "</span>) + strerror(errno));</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  }</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  memset(m_Socket, 0, <span class="keyword">sizeof</span>(m_Socket));</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> }</div><div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_a72e0661331d20d0a352fb49c388a1b05"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#a72e0661331d20d0a352fb49c388a1b05">armnnUtils::Sockets::Close</a></div><div class="ttdeci">int Close(Socket s)</div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00028">NetworkSockets.cpp:28</a></div></div> |
| 179 | <div class="ttc" id="classarmnn_1_1_runtime_exception_html"><div class="ttname"><a href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00120">Exceptions.hpp:120</a></div></div> |
| 180 | </div><!-- fragment --> |
| 181 | </div> |
| 182 | </div> |
| 183 | <a id="aaca9d54975c036540e7e5299a0c6df7a"></a> |
| 184 | <h2 class="memtitle"><span class="permalink"><a href="#aaca9d54975c036540e7e5299a0c6df7a">◆ </a></span>IsOpen()</h2> |
| 185 | |
| 186 | <div class="memitem"> |
| 187 | <div class="memproto"> |
| 188 | <table class="mlabels"> |
| 189 | <tr> |
| 190 | <td class="mlabels-left"> |
| 191 | <table class="memname"> |
| 192 | <tr> |
| 193 | <td class="memname">bool IsOpen </td> |
| 194 | <td>(</td> |
| 195 | <td class="paramname"></td><td>)</td> |
| 196 | <td> const</td> |
| 197 | </tr> |
| 198 | </table> |
| 199 | </td> |
| 200 | <td class="mlabels-right"> |
| 201 | <span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span> </td> |
| 202 | </tr> |
| 203 | </table> |
| 204 | </div><div class="memdoc"> |
| 205 | |
| 206 | <p>Implements <a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html#a8a3511046982c64efa3e3833d749e5ef">IProfilingConnection</a>.</p> |
| 207 | |
| 208 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00053">53</a> of file <a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a>.</p> |
| 209 | <div class="fragment"><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keywordflow">return</span> m_Socket[0].fd > 0;</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> }</div></div><!-- fragment --> |
| 210 | </div> |
| 211 | </div> |
| 212 | <a id="a15c46007b7627c887593d267023fbfa4"></a> |
| 213 | <h2 class="memtitle"><span class="permalink"><a href="#a15c46007b7627c887593d267023fbfa4">◆ </a></span>ReadPacket()</h2> |
| 214 | |
| 215 | <div class="memitem"> |
| 216 | <div class="memproto"> |
| 217 | <table class="mlabels"> |
| 218 | <tr> |
| 219 | <td class="mlabels-left"> |
| 220 | <table class="memname"> |
| 221 | <tr> |
| 222 | <td class="memname"><a class="el" href="classarmnn_1_1profiling_1_1_packet.html">Packet</a> ReadPacket </td> |
| 223 | <td>(</td> |
| 224 | <td class="paramtype">uint32_t </td> |
| 225 | <td class="paramname"><em>timeout</em></td><td>)</td> |
| 226 | <td></td> |
| 227 | </tr> |
| 228 | </table> |
| 229 | </td> |
| 230 | <td class="mlabels-right"> |
| 231 | <span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span> </td> |
| 232 | </tr> |
| 233 | </table> |
| 234 | </div><div class="memdoc"> |
| 235 | |
| 236 | <p>Implements <a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html#a935e16d85893a31f23cd78e47b85466d">IProfilingConnection</a>.</p> |
| 237 | |
| 238 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00078">78</a> of file <a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a>.</p> |
| 239 | |
| 240 | <p class="reference">References <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00058">SocketProfilingConnection::Close()</a>, <a class="el" href="_network_sockets_8cpp_source.html#l00069">armnnUtils::Sockets::Ioctl()</a>, <a class="el" href="_network_sockets_8cpp_source.html#l00081">armnnUtils::Sockets::Poll()</a>, and <a class="el" href="_network_sockets_8cpp_source.html#l00060">armnnUtils::Sockets::Read()</a>.</p> |
| 241 | <div class="fragment"><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> {</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment">// Is there currently at least a header worth of data waiting to be read?</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="keywordtype">int</span> bytes_available = 0;</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="namespacearmnn_utils_1_1_sockets.html#a36eb04939ffbb4d4a1291724921a6c6a">Sockets::Ioctl</a>(m_Socket[0].fd, FIONREAD, &bytes_available);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">if</span> (bytes_available >= 8)</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  {</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="comment">// Yes there is. Read it:</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordflow">return</span> ReceivePacket();</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  }</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="comment">// Poll for data on the socket or until timeout occurs</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordtype">int</span> pollResult = <a class="code" href="namespacearmnn_utils_1_1_sockets.html#a242d840b21fc2f18ac1ec8d609180e15">Sockets::Poll</a>(&m_Socket[0], 1, static_cast<int>(timeout));</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">switch</span> (pollResult)</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  {</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">case</span> -1: <span class="comment">// Error</span></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Read failure from socket: "</span>) + strerror(errno));</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">case</span> 0: <span class="comment">// Timeout</span></div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_timeout_exception.html">TimeoutException</a>(<span class="stringliteral">"Timeout while reading from socket"</span>);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keywordflow">default</span>: <span class="comment">// Normal poll return but it could still contain an error signal</span></div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="comment">// Check if the socket reported an error</span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keywordflow">if</span> (m_Socket[0].revents & (POLLNVAL | POLLERR | POLLHUP))</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  {</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordflow">if</span> (m_Socket[0].revents == POLLNVAL)</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  {</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="comment">// This is an unrecoverable error.</span></div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <a class="code" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">Close</a>();</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Error while polling receiving socket: POLLNVAL"</span>));</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  }</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span> (m_Socket[0].revents == POLLERR)</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  {</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Error while polling receiving socket: POLLERR: "</span>) +</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  strerror(errno));</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  }</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordflow">if</span> (m_Socket[0].revents == POLLHUP)</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  {</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">// This is an unrecoverable error.</span></div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">Close</a>();</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(std::string(<span class="stringliteral">"Connection closed by remote client: POLLHUP"</span>));</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  }</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  }</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="comment">// Check if there is data to read</span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordflow">if</span> (!(m_Socket[0].revents & (POLLIN)))</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">// This is a corner case. The socket as been woken up but not with any data.</span></div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">// We'll throw a timeout exception to loop around again.</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_timeout_exception.html">armnn::TimeoutException</a>(<span class="stringliteral">"File descriptor was polled but no data was available to receive."</span>);</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  }</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> </div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordflow">return</span> ReceivePacket();</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  }</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> }</div><div class="ttc" id="classarmnn_1_1profiling_1_1_socket_profiling_connection_html_a29dc6798f18d73abd4ba8e4910f6831f"><div class="ttname"><a href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html#a29dc6798f18d73abd4ba8e4910f6831f">armnn::profiling::SocketProfilingConnection::Close</a></div><div class="ttdeci">void Close() final</div><div class="ttdef"><b>Definition:</b> <a href="_socket_profiling_connection_8cpp_source.html#l00058">SocketProfilingConnection.cpp:58</a></div></div> |
| 242 | <div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_a242d840b21fc2f18ac1ec8d609180e15"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#a242d840b21fc2f18ac1ec8d609180e15">armnnUtils::Sockets::Poll</a></div><div class="ttdeci">int Poll(PollFd *fds, nfds_t numFds, int timeout)</div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00081">NetworkSockets.cpp:81</a></div></div> |
| 243 | <div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_a36eb04939ffbb4d4a1291724921a6c6a"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#a36eb04939ffbb4d4a1291724921a6c6a">armnnUtils::Sockets::Ioctl</a></div><div class="ttdeci">int Ioctl(Socket s, unsigned long int cmd, void *arg)</div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00069">NetworkSockets.cpp:69</a></div></div> |
| 244 | <div class="ttc" id="classarmnn_1_1_runtime_exception_html"><div class="ttname"><a href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00120">Exceptions.hpp:120</a></div></div> |
| 245 | <div class="ttc" id="classarmnn_1_1_timeout_exception_html"><div class="ttname"><a href="classarmnn_1_1_timeout_exception.html">armnn::TimeoutException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00135">Exceptions.hpp:135</a></div></div> |
| 246 | </div><!-- fragment --> |
| 247 | </div> |
| 248 | </div> |
| 249 | <a id="a096549d574d3fc51e6948efd24988f3e"></a> |
| 250 | <h2 class="memtitle"><span class="permalink"><a href="#a096549d574d3fc51e6948efd24988f3e">◆ </a></span>WritePacket()</h2> |
| 251 | |
| 252 | <div class="memitem"> |
| 253 | <div class="memproto"> |
| 254 | <table class="mlabels"> |
| 255 | <tr> |
| 256 | <td class="mlabels-left"> |
| 257 | <table class="memname"> |
| 258 | <tr> |
| 259 | <td class="memname">bool WritePacket </td> |
| 260 | <td>(</td> |
| 261 | <td class="paramtype">const unsigned char * </td> |
| 262 | <td class="paramname"><em>buffer</em>, </td> |
| 263 | </tr> |
| 264 | <tr> |
| 265 | <td class="paramkey"></td> |
| 266 | <td></td> |
| 267 | <td class="paramtype">uint32_t </td> |
| 268 | <td class="paramname"><em>length</em> </td> |
| 269 | </tr> |
| 270 | <tr> |
| 271 | <td></td> |
| 272 | <td>)</td> |
| 273 | <td></td><td></td> |
| 274 | </tr> |
| 275 | </table> |
| 276 | </td> |
| 277 | <td class="mlabels-right"> |
| 278 | <span class="mlabels"><span class="mlabel">final</span><span class="mlabel">virtual</span></span> </td> |
| 279 | </tr> |
| 280 | </table> |
| 281 | </div><div class="memdoc"> |
| 282 | |
| 283 | <p>Implements <a class="el" href="classarmnn_1_1profiling_1_1_i_profiling_connection.html#ac78c6bd1a545934a805c88194214b09d">IProfilingConnection</a>.</p> |
| 284 | |
| 285 | <p class="definition">Definition at line <a class="el" href="_socket_profiling_connection_8cpp_source.html#l00068">68</a> of file <a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a>.</p> |
| 286 | |
| 287 | <p class="reference">References <a class="el" href="_network_sockets_8cpp_source.html#l00050">armnnUtils::Sockets::Write()</a>.</p> |
| 288 | <div class="fragment"><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span> (buffer == <span class="keyword">nullptr</span> || length == 0)</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">return</span> <a class="code" href="namespacearmnn_utils_1_1_sockets.html#ad5b08981ac047ff0a3c7cb3442b9f161">Sockets::Write</a>(m_Socket[0].fd, buffer, length) != -1;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> }</div><div class="ttc" id="namespacearmnn_utils_1_1_sockets_html_ad5b08981ac047ff0a3c7cb3442b9f161"><div class="ttname"><a href="namespacearmnn_utils_1_1_sockets.html#ad5b08981ac047ff0a3c7cb3442b9f161">armnnUtils::Sockets::Write</a></div><div class="ttdeci">long Write(Socket s, const void *buf, size_t len)</div><div class="ttdef"><b>Definition:</b> <a href="_network_sockets_8cpp_source.html#l00050">NetworkSockets.cpp:50</a></div></div> |
| 289 | </div><!-- fragment --> |
| 290 | </div> |
| 291 | </div> |
| 292 | <hr/>The documentation for this class was generated from the following files:<ul> |
| 293 | <li>src/profiling/<a class="el" href="_socket_profiling_connection_8hpp_source.html">SocketProfilingConnection.hpp</a></li> |
| 294 | <li>src/profiling/<a class="el" href="_socket_profiling_connection_8cpp_source.html">SocketProfilingConnection.cpp</a></li> |
| 295 | </ul> |
| 296 | </div><!-- contents --> |
| 297 | </div><!-- doc-content --> |
| 298 | <!-- start footer part --> |
| 299 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 300 | <ul> |
| 301 | <li class="navelem"><a class="el" href="namespacearmnn.html">armnn</a></li><li class="navelem"><a class="el" href="namespacearmnn_1_1profiling.html">profiling</a></li><li class="navelem"><a class="el" href="classarmnn_1_1profiling_1_1_socket_profiling_connection.html">SocketProfilingConnection</a></li> |
| 302 | <li class="footer">Generated on Fri Mar 13 2020 16:07:06 for ArmNN by |
| 303 | <a href="http://www.doxygen.org/index.html"> |
| 304 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 305 | </ul> |
| 306 | </div> |
| 307 | </body> |
| 308 | </html> |