Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!-- Copyright (c) 2020 ARM Limited. --> |
| 2 | <!-- --> |
| 3 | <!-- SPDX-License-Identifier: MIT --> |
| 4 | <!-- --> |
| 5 | <!-- HTML header for doxygen 1.8.13--> |
| 6 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 7 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 8 | <head> |
| 9 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 10 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 11 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 12 | <meta name="robots" content="NOINDEX, NOFOLLOW" /> |
| 13 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 14 | <title>ArmNN: CommandFileParser Class Reference</title> |
| 15 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 16 | <script type="text/javascript" src="jquery.js"></script> |
| 17 | <script type="text/javascript" src="dynsections.js"></script> |
| 18 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 19 | <script type="text/javascript" src="resize.js"></script> |
| 20 | <script type="text/javascript" src="navtreedata.js"></script> |
| 21 | <script type="text/javascript" src="navtree.js"></script> |
| 22 | <script type="text/javascript"> |
| 23 | $(document).ready(initResizable); |
| 24 | </script> |
| 25 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 26 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 27 | <script type="text/javascript" src="search/search.js"></script> |
| 28 | <script type="text/x-mathjax-config"> |
| 29 | MathJax.Hub.Config({ |
| 30 | extensions: ["tex2jax.js"], |
| 31 | jax: ["input/TeX","output/HTML-CSS"], |
| 32 | }); |
| 33 | </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> |
| 34 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 35 | <link href="stylesheet.css" rel="stylesheet" type="text/css"/> |
| 36 | </head> |
| 37 | <body> |
| 38 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 39 | <div id="titlearea"> |
| 40 | <table cellspacing="0" cellpadding="0"> |
| 41 | <tbody> |
| 42 | <tr style="height: 56px;"> |
| 43 | <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/> |
| 44 | <td style="padding-left: 0.5em;"> |
| 45 | <div id="projectname"> |
| 46 |  <span id="projectnumber">20.02</span> |
| 47 | </div> |
| 48 | </td> |
| 49 | </tr> |
| 50 | </tbody> |
| 51 | </table> |
| 52 | </div> |
| 53 | <!-- end header part --> |
| 54 | <!-- Generated by Doxygen 1.8.13 --> |
| 55 | <script type="text/javascript"> |
| 56 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 57 | </script> |
| 58 | <script type="text/javascript" src="menudata.js"></script> |
| 59 | <script type="text/javascript" src="menu.js"></script> |
| 60 | <script type="text/javascript"> |
| 61 | $(function() { |
| 62 | initMenu('',true,false,'search.php','Search'); |
| 63 | $(document).ready(function() { init_search(); }); |
| 64 | }); |
| 65 | </script> |
| 66 | <div id="main-nav"></div> |
| 67 | </div><!-- top --> |
| 68 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 69 | <div id="nav-tree"> |
| 70 | <div id="nav-tree-contents"> |
| 71 | <div id="nav-sync" class="sync"></div> |
| 72 | </div> |
| 73 | </div> |
| 74 | <div id="splitbar" style="-moz-user-select:none;" |
| 75 | class="ui-resizable-handle"> |
| 76 | </div> |
| 77 | </div> |
| 78 | <script type="text/javascript"> |
| 79 | $(document).ready(function(){initNavTree('classarmnn_1_1gatordmock_1_1_command_file_parser.xhtml','');}); |
| 80 | </script> |
| 81 | <div id="doc-content"> |
| 82 | <!-- window showing the filter options --> |
| 83 | <div id="MSearchSelectWindow" |
| 84 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 85 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 86 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 87 | </div> |
| 88 | |
| 89 | <!-- iframe showing the search results (closed by default) --> |
| 90 | <div id="MSearchResultsWindow"> |
| 91 | <iframe src="javascript:void(0)" frameborder="0" |
| 92 | name="MSearchResults" id="MSearchResults"> |
| 93 | </iframe> |
| 94 | </div> |
| 95 | |
| 96 | <div class="header"> |
| 97 | <div class="summary"> |
| 98 | <a href="#pub-methods">Public Member Functions</a> | |
| 99 | <a href="classarmnn_1_1gatordmock_1_1_command_file_parser-members.xhtml">List of all members</a> </div> |
| 100 | <div class="headertitle"> |
| 101 | <div class="title">CommandFileParser Class Reference</div> </div> |
| 102 | </div><!--header--> |
| 103 | <div class="contents"> |
| 104 | |
| 105 | <p>This class parses a command file for the <a class="el" href="classarmnn_1_1gatordmock_1_1_gatord_mock_service.xhtml" title="A class that implements a Mock Gatord server. ">GatordMockService</a>. |
| 106 | <a href="classarmnn_1_1gatordmock_1_1_command_file_parser.xhtml#details">More...</a></p> |
| 107 | |
| 108 | <p><code>#include <<a class="el" href="_command_file_parser_8hpp_source.xhtml">CommandFileParser.hpp</a>></code></p> |
| 109 | <table class="memberdecls"> |
| 110 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> |
| 111 | Public Member Functions</h2></td></tr> |
| 112 | <tr class="memitem:a224fc15053b9579998ce82f22038bab1"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classarmnn_1_1gatordmock_1_1_command_file_parser.xhtml#a224fc15053b9579998ce82f22038bab1">ParseFile</a> (std::string CommandFile, <a class="el" href="classarmnn_1_1gatordmock_1_1_gatord_mock_service.xhtml">GatordMockService</a> &mockService)</td></tr> |
| 113 | <tr class="separator:a224fc15053b9579998ce82f22038bab1"><td class="memSeparator" colspan="2"> </td></tr> |
| 114 | </table> |
| 115 | <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| 116 | <div class="textblock"><p>This class parses a command file for the <a class="el" href="classarmnn_1_1gatordmock_1_1_gatord_mock_service.xhtml" title="A class that implements a Mock Gatord server. ">GatordMockService</a>. </p> |
| 117 | <p>The file contains one command per line. Valid commands are: SET and WAIT.</p> |
| 118 | <p>SET: Will construct and send a PeriodicCounterSelection packet to enable a set of counters. WAIT: Will pause for a set period of time to allow for data to be received. </p> |
| 119 | |
| 120 | <p class="definition">Definition at line <a class="el" href="_command_file_parser_8hpp_source.xhtml#l00022">22</a> of file <a class="el" href="_command_file_parser_8hpp_source.xhtml">CommandFileParser.hpp</a>.</p> |
| 121 | </div><h2 class="groupheader">Member Function Documentation</h2> |
| 122 | <a id="a224fc15053b9579998ce82f22038bab1"></a> |
| 123 | <h2 class="memtitle"><span class="permalink"><a href="#a224fc15053b9579998ce82f22038bab1">◆ </a></span>ParseFile()</h2> |
| 124 | |
| 125 | <div class="memitem"> |
| 126 | <div class="memproto"> |
| 127 | <table class="memname"> |
| 128 | <tr> |
| 129 | <td class="memname">void ParseFile </td> |
| 130 | <td>(</td> |
| 131 | <td class="paramtype">std::string </td> |
| 132 | <td class="paramname"><em>CommandFile</em>, </td> |
| 133 | </tr> |
| 134 | <tr> |
| 135 | <td class="paramkey"></td> |
| 136 | <td></td> |
| 137 | <td class="paramtype"><a class="el" href="classarmnn_1_1gatordmock_1_1_gatord_mock_service.xhtml">GatordMockService</a> & </td> |
| 138 | <td class="paramname"><em>mockService</em> </td> |
| 139 | </tr> |
| 140 | <tr> |
| 141 | <td></td> |
| 142 | <td>)</td> |
| 143 | <td></td><td></td> |
| 144 | </tr> |
| 145 | </table> |
| 146 | </div><div class="memdoc"> |
| 147 | |
| 148 | <p class="definition">Definition at line <a class="el" href="_command_file_parser_8cpp_source.xhtml#l00019">19</a> of file <a class="el" href="_command_file_parser_8cpp_source.xhtml">CommandFileParser.cpp</a>.</p> |
| 149 | |
| 150 | <p class="reference">References <a class="el" href="_gatord_mock_service_8hpp_source.xhtml#l00092">GatordMockService::ReceiveThreadRunning()</a>, <a class="el" href="_gatord_mock_service_8cpp_source.xhtml#l00181">GatordMockService::SendPeriodicCounterSelectionList()</a>, <a class="el" href="_gatord_mock_service_8cpp_source.xhtml#l00139">GatordMockService::SendRequestCounterDir()</a>, and <a class="el" href="_gatord_mock_service_8cpp_source.xhtml#l00214">GatordMockService::WaitCommand()</a>.</p> |
| 151 | |
| 152 | <p class="reference">Referenced by <a class="el" href="_gatord_mock_main_8cpp_source.xhtml#l00018">main()</a>.</p> |
| 153 | <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>  std::ifstream infile(CommandFile);</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  std::string line;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  std::cout << <span class="stringliteral">"Parsing command file: "</span> << CommandFile << std::endl;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keywordflow">while</span> (mockService.ReceiveThreadRunning() && std::getline(infile, line))</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  {</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  std::istringstream iss(line);</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  std::vector<std::string> tokens;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(),</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  std::back_inserter(tokens));</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">if</span> (tokens.size() > 0)</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  std::string command = tokens[0];</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordflow">if</span> (command == <span class="stringliteral">"LIST"</span>)</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>  <span class="comment">// Expected format for the SET command</span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="comment">//</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="comment">// LIST</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="comment">//</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  mockService.SendRequestCounterDir();</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="keywordflow">if</span> (command == <span class="stringliteral">"SET"</span>)</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  {</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="comment">// Expected format for the SET command</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="comment">//</span></div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="comment">// SET 500000 1 2 5 10</span></div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">//</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">// This breaks down to:</span></div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// SET command</span></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">// 500000 polling period in micro seconds</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="comment">// 1 2 5 10 counter list</span></div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">if</span> (tokens.size() > 2) <span class="comment">// minimum of 3 tokens.</span></div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  uint32_t period = <span class="keyword">static_cast<</span>uint32_t<span class="keyword">></span>(std::stoul(tokens[1]));</div><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>  std::vector<uint16_t> counters;</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>  std::transform(tokens.begin() + 2, tokens.end(), std::back_inserter(counters),</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  [](<span class="keyword">const</span> std::string& str)</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  { <span class="keywordflow">return</span> <span class="keyword">static_cast<</span>uint16_t<span class="keyword">></span>(std::stoul(str)); });</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  mockService.SendPeriodicCounterSelectionList(period, counters);</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  }</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">else</span></div><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>  std::cerr << <span class="stringliteral">"Invalid SET command. Format is: SET <polling period> <id list>"</span> << std::endl;</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>  }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (command == <span class="stringliteral">"WAIT"</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="comment">// Expected format for the SET command</span></div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="comment">//</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="comment">// WAIT 11000000</span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">//</span></div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// This breaks down to:</span></div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment">// WAIT command</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="comment">// 11000000 timeout period in micro seconds</span></div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (tokens.size() > 1) <span class="comment">// minimum of 2 tokens.</span></div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  {</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  uint32_t timeout = <span class="keyword">static_cast<</span>uint32_t<span class="keyword">></span>(std::stoul(tokens[1]));</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  mockService.WaitCommand(timeout);</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordflow">else</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>  std::cerr << <span class="stringliteral">"Invalid WAIT command. Format is: WAIT <interval>"</span> << std::endl;</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</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>  }</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> }</div></div><!-- fragment --> |
| 154 | </div> |
| 155 | </div> |
| 156 | <hr/>The documentation for this class was generated from the following files:<ul> |
| 157 | <li>tests/profiling/gatordmock/<a class="el" href="_command_file_parser_8hpp_source.xhtml">CommandFileParser.hpp</a></li> |
| 158 | <li>tests/profiling/gatordmock/<a class="el" href="_command_file_parser_8cpp_source.xhtml">CommandFileParser.cpp</a></li> |
| 159 | </ul> |
| 160 | </div><!-- contents --> |
| 161 | </div><!-- doc-content --> |
| 162 | <!-- start footer part --> |
| 163 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 164 | <ul> |
| 165 | <li class="navelem"><a class="el" href="namespacearmnn.xhtml">armnn</a></li><li class="navelem"><a class="el" href="namespacearmnn_1_1gatordmock.xhtml">gatordmock</a></li><li class="navelem"><a class="el" href="classarmnn_1_1gatordmock_1_1_command_file_parser.xhtml">CommandFileParser</a></li> |
| 166 | <li class="footer">Generated on Fri Mar 13 2020 16:09:20 for ArmNN by |
| 167 | <a href="http://www.doxygen.org/index.html"> |
| 168 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 169 | </ul> |
| 170 | </div> |
| 171 | </body> |
| 172 | </html> |