pypdevsbbl.tracers.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>pypdevsbbl.tracers package &#8212; Python(P)DEVS-BBL documentation</title>
  8. <link rel="stylesheet" href="_static/nature.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  10. <link rel="stylesheet" type="text/css" href="_static/custom.css" />
  11. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  12. <script type="text/javascript" src="_static/jquery.js"></script>
  13. <script type="text/javascript" src="_static/underscore.js"></script>
  14. <script type="text/javascript" src="_static/doctools.js"></script>
  15. <script type="text/javascript" src="_static/language_data.js"></script>
  16. <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  17. <link rel="index" title="Index" href="genindex.html" />
  18. <link rel="search" title="Search" href="search.html" />
  19. <link rel="next" title="pypdevsbbl.tracers.FootprintTracer module" href="pypdevsbbl.tracers.FootprintTracer.html" />
  20. <link rel="prev" title="pypdevsbbl.generic.transformers module" href="pypdevsbbl.generic.transformers.html" />
  21. </head><body>
  22. <div class="related" role="navigation" aria-label="related navigation">
  23. <h3>Navigation</h3>
  24. <ul>
  25. <li class="right" style="margin-right: 10px">
  26. <a href="genindex.html" title="General Index"
  27. accesskey="I">index</a></li>
  28. <li class="right" >
  29. <a href="py-modindex.html" title="Python Module Index"
  30. >modules</a> |</li>
  31. <li class="right" >
  32. <a href="pypdevsbbl.tracers.FootprintTracer.html" title="pypdevsbbl.tracers.FootprintTracer module"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
  36. accesskey="P">previous</a> |</li>
  37. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  38. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" accesskey="U">pypdevsbbl package</a> &#187;</li>
  39. </ul>
  40. </div>
  41. <div class="document">
  42. <div class="documentwrapper">
  43. <div class="bodywrapper">
  44. <div class="body" role="main">
  45. <div class="section" id="module-pypdevsbbl.tracers">
  46. <span id="pypdevsbbl-tracers-package"></span><h1>pypdevsbbl.tracers package<a class="headerlink" href="#module-pypdevsbbl.tracers" title="Permalink to this headline">¶</a></h1>
  47. <p>Create and use tracers for your models.</p>
  48. <p>This file provides a basic tracer (<a class="reference internal" href="#pypdevsbbl.tracers.BaseTracer" title="pypdevsbbl.tracers.BaseTracer"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseTracer</span></code></a>) that can
  49. be used as a superclass for all custom tracers. Furthermore, a
  50. <a class="reference internal" href="#pypdevsbbl.tracers.setTracer" title="pypdevsbbl.tracers.setTracer"><code class="xref py py-meth docutils literal notranslate"><span class="pre">setTracer()</span></code></a> function is provided to allow for more complex
  51. tracing possibilities.</p>
  52. <p>The subpackage also provides a few commonly used tracers in
  53. production-based models.</p>
  54. <dl class="data">
  55. <dt id="pypdevsbbl.tracers._hashes">
  56. <code class="descclassname">pypdevsbbl.tracers.</code><code class="descname">_hashes</code><em class="property"> = {}</em><a class="headerlink" href="#pypdevsbbl.tracers._hashes" title="Permalink to this definition">¶</a></dt>
  57. <dd><p>Helper variable that will allow the <a class="reference internal" href="#pypdevsbbl.tracers.setTracer" title="pypdevsbbl.tracers.setTracer"><code class="xref py py-meth docutils literal notranslate"><span class="pre">setTracer()</span></code></a> method to work.</p>
  58. <p>It is a dict of the <code class="xref py py-meth docutils literal notranslate"><span class="pre">id()</span></code>-value of a tracer and its arguments.</p>
  59. </dd></dl>
  60. <dl class="function">
  61. <dt id="pypdevsbbl.tracers._hashedTracer">
  62. <code class="descclassname">pypdevsbbl.tracers.</code><code class="descname">_hashedTracer</code><span class="sig-paren">(</span><em>uid</em>, <em>server</em>, <em>tracer</em>, <em>*hargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#_hashedTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers._hashedTracer" title="Permalink to this definition">¶</a></dt>
  63. <dd><p>Helper function to set the tracer.</p>
  64. </dd></dl>
  65. <dl class="function">
  66. <dt id="pypdevsbbl.tracers.setTracer">
  67. <code class="descclassname">pypdevsbbl.tracers.</code><code class="descname">setTracer</code><span class="sig-paren">(</span><em>simulator</em>, <em>tracerclass</em>, <em>*args</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#setTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.setTracer" title="Permalink to this definition">¶</a></dt>
  68. <dd><p>Assigns a custom tracer with variable arguments.</p>
  69. <p>In <cite>PythonPDEVS</cite>’ custom tracer registration process, all
  70. additional arguments are casted to a string before passed
  71. to an <code class="xref py py-meth docutils literal notranslate"><span class="pre">eval()</span></code> function call. Not all objects can be
  72. cast to a string and still retain their information.</p>
  73. <p>This function allows you to set a tracer with custom
  74. arguments that cannot be cast to a string.</p>
  75. <div class="admonition seealso">
  76. <p class="first admonition-title">See also</p>
  77. <p class="last"><code class="file docutils literal notranslate"><span class="pre">src/dependencies/pythonpdevs/src/pypdevs/tracer.py:40-42</span></code></p>
  78. </div>
  79. <table class="docutils field-list" frame="void" rules="none">
  80. <col class="field-name" />
  81. <col class="field-body" />
  82. <tbody valign="top">
  83. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  84. <li><strong>simulator</strong> – The simulator to set the tracer on.</li>
  85. <li><strong>tracerclass</strong> – The tracer class to set as an
  86. instatiatable.</li>
  87. <li><strong>*args</strong> – All arguments to pass to the tracer’s
  88. <code class="xref py py-meth docutils literal notranslate"><span class="pre">__init__()</span></code>-call, <strong>except</strong> the
  89. <code class="docutils literal notranslate"><span class="pre">uid</span></code> and the <code class="docutils literal notranslate"><span class="pre">server</span></code>.</li>
  90. </ul>
  91. </td>
  92. </tr>
  93. </tbody>
  94. </table>
  95. </dd></dl>
  96. <dl class="function">
  97. <dt id="pypdevsbbl.tracers.superTrace">
  98. <code class="descclassname">pypdevsbbl.tracers.</code><code class="descname">superTrace</code><span class="sig-paren">(</span><em>server</em>, <em>uid</em>, <em>model</em>, <em>args</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#superTrace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.superTrace" title="Permalink to this definition">¶</a></dt>
  99. <dd></dd></dl>
  100. <dl class="class">
  101. <dt id="pypdevsbbl.tracers.BaseTracer">
  102. <em class="property">class </em><code class="descclassname">pypdevsbbl.tracers.</code><code class="descname">BaseTracer</code><span class="sig-paren">(</span><em>uid</em>, <em>server</em>, <em>filename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer" title="Permalink to this definition">¶</a></dt>
  103. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
  104. <p>Base for all custom tracers.</p>
  105. <p>Implements all required methods for a custom tracer.</p>
  106. <table class="docutils field-list" frame="void" rules="none">
  107. <col class="field-name" />
  108. <col class="field-body" />
  109. <tbody valign="top">
  110. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  111. <li><strong>uid</strong> – A unique identifier for distributed simulation.
  112. Can be ignored, but must be the first argument!</li>
  113. <li><strong>server</strong> – The server that runs the distributed simulation.
  114. Can be ignored, but must be the second argument!</li>
  115. <li><strong>filename</strong> – The name of the file to write the results to.
  116. When <code class="docutils literal notranslate"><span class="pre">None</span></code>, all results will be written to the
  117. standard output.</li>
  118. </ul>
  119. </td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. <dl class="method">
  124. <dt id="pypdevsbbl.tracers.BaseTracer.startTracer">
  125. <code class="descname">startTracer</code><span class="sig-paren">(</span><em>recover</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.startTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.startTracer" title="Permalink to this definition">¶</a></dt>
  126. <dd><p>Starts the Tracer</p>
  127. <table class="docutils field-list" frame="void" rules="none">
  128. <col class="field-name" />
  129. <col class="field-body" />
  130. <tbody valign="top">
  131. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>recover</strong> (<em>bool</em>) – Represents whether or not this is a recovered call.
  132. E.g., should the file be overwritten (<code class="docutils literal notranslate"><span class="pre">False</span></code>) or
  133. appended to (<code class="docutils literal notranslate"><span class="pre">True</span></code>)?</td>
  134. </tr>
  135. </tbody>
  136. </table>
  137. </dd></dl>
  138. <dl class="method">
  139. <dt id="pypdevsbbl.tracers.BaseTracer.stopTracer">
  140. <code class="descname">stopTracer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.stopTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.stopTracer" title="Permalink to this definition">¶</a></dt>
  141. <dd><p>Stops the tracer (e.g., flush the file)</p>
  142. </dd></dl>
  143. <dl class="method">
  144. <dt id="pypdevsbbl.tracers.BaseTracer.trace">
  145. <code class="descname">trace</code><span class="sig-paren">(</span><em>*text</em>, <em>sep=' '</em>, <em>end=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.trace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.trace" title="Permalink to this definition">¶</a></dt>
  146. <dd><p>Actual tracing function.</p>
  147. <p>This function sort of works like the “print” function,
  148. but only takes strings or bytes as arguments.</p>
  149. <table class="docutils field-list" frame="void" rules="none">
  150. <col class="field-name" />
  151. <col class="field-body" />
  152. <tbody valign="top">
  153. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  154. <li><strong>text</strong> – The text to trace.</li>
  155. <li><strong>sep</strong> (<em>str</em>) – The text separator. Defaults to a space.</li>
  156. <li><strong>end</strong> (<em>str</em>) – The ending token of the stream to write.
  157. Defaults to the empty string.</li>
  158. </ul>
  159. </td>
  160. </tr>
  161. </tbody>
  162. </table>
  163. </dd></dl>
  164. <dl class="method">
  165. <dt id="pypdevsbbl.tracers.BaseTracer.traceInternal">
  166. <code class="descname">traceInternal</code><span class="sig-paren">(</span><em>aDEVS</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.traceInternal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.traceInternal" title="Permalink to this definition">¶</a></dt>
  167. <dd><p>Called for each atomic DEVS model that does an internal transition.</p>
  168. </dd></dl>
  169. <dl class="method">
  170. <dt id="pypdevsbbl.tracers.BaseTracer.traceExternal">
  171. <code class="descname">traceExternal</code><span class="sig-paren">(</span><em>aDEVS</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.traceExternal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.traceExternal" title="Permalink to this definition">¶</a></dt>
  172. <dd><p>Called for each atomic DEVS model that does an external transition.</p>
  173. </dd></dl>
  174. <dl class="method">
  175. <dt id="pypdevsbbl.tracers.BaseTracer.traceConfluent">
  176. <code class="descname">traceConfluent</code><span class="sig-paren">(</span><em>aDEVS</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.traceConfluent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.traceConfluent" title="Permalink to this definition">¶</a></dt>
  177. <dd><p>Called for each atomic DEVS model that does a confluent transition.</p>
  178. </dd></dl>
  179. <dl class="method">
  180. <dt id="pypdevsbbl.tracers.BaseTracer.traceInit">
  181. <code class="descname">traceInit</code><span class="sig-paren">(</span><em>aDEVS</em>, <em>t</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.traceInit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.traceInit" title="Permalink to this definition">¶</a></dt>
  182. <dd><p>Called upon initialization of a model.</p>
  183. <table class="docutils field-list" frame="void" rules="none">
  184. <col class="field-name" />
  185. <col class="field-body" />
  186. <tbody valign="top">
  187. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<em>numeric</em>) – The time at which the model commences (likely 0).</td>
  188. </tr>
  189. </tbody>
  190. </table>
  191. </dd></dl>
  192. <dl class="method">
  193. <dt id="pypdevsbbl.tracers.BaseTracer.traceUser">
  194. <code class="descname">traceUser</code><span class="sig-paren">(</span><em>time</em>, <em>aDEVS</em>, <em>variable</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers.html#BaseTracer.traceUser"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.BaseTracer.traceUser" title="Permalink to this definition">¶</a></dt>
  195. <dd><p>Called upon so-called <em>god events</em> during debugging.</p>
  196. <p>A <em>god event</em> is an event where a user manually alters the state of an
  197. atomic DEVS instance.</p>
  198. </dd></dl>
  199. </dd></dl>
  200. <div class="section" id="submodules">
  201. <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
  202. <div class="toctree-wrapper compound">
  203. <ul>
  204. <li class="toctree-l1"><a class="reference internal" href="pypdevsbbl.tracers.FootprintTracer.html">pypdevsbbl.tracers.FootprintTracer module</a></li>
  205. <li class="toctree-l1"><a class="reference internal" href="pypdevsbbl.tracers.PlotTracer.html">pypdevsbbl.tracers.PlotTracer module</a></li>
  206. <li class="toctree-l1"><a class="reference internal" href="pypdevsbbl.tracers.ProfileTracer.html">pypdevsbbl.tracers.ProfileTracer module</a></li>
  207. <li class="toctree-l1"><a class="reference internal" href="pypdevsbbl.tracers.StatisticsTracer.html">pypdevsbbl.tracers.StatisticsTracer module</a></li>
  208. </ul>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  216. <div class="sphinxsidebarwrapper">
  217. <h4>Previous topic</h4>
  218. <p class="topless"><a href="pypdevsbbl.generic.transformers.html"
  219. title="previous chapter">pypdevsbbl.generic.transformers module</a></p>
  220. <h4>Next topic</h4>
  221. <p class="topless"><a href="pypdevsbbl.tracers.FootprintTracer.html"
  222. title="next chapter">pypdevsbbl.tracers.FootprintTracer module</a></p>
  223. <div id="searchbox" style="display: none" role="search">
  224. <h3>Quick search</h3>
  225. <div class="searchformwrapper">
  226. <form class="search" action="search.html" method="get">
  227. <input type="text" name="q" />
  228. <input type="submit" value="Go" />
  229. <input type="hidden" name="check_keywords" value="yes" />
  230. <input type="hidden" name="area" value="default" />
  231. </form>
  232. </div>
  233. </div>
  234. <script type="text/javascript">$('#searchbox').show(0);</script>
  235. </div>
  236. </div>
  237. <div class="clearer"></div>
  238. </div>
  239. <div class="related" role="navigation" aria-label="related navigation">
  240. <h3>Navigation</h3>
  241. <ul>
  242. <li class="right" style="margin-right: 10px">
  243. <a href="genindex.html" title="General Index"
  244. >index</a></li>
  245. <li class="right" >
  246. <a href="py-modindex.html" title="Python Module Index"
  247. >modules</a> |</li>
  248. <li class="right" >
  249. <a href="pypdevsbbl.tracers.FootprintTracer.html" title="pypdevsbbl.tracers.FootprintTracer module"
  250. >next</a> |</li>
  251. <li class="right" >
  252. <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
  253. >previous</a> |</li>
  254. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  255. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  256. </ul>
  257. </div>
  258. <div class="footer" role="contentinfo">
  259. &#169; Copyright 2020, Randy Paredis.
  260. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
  261. </div>
  262. </body>
  263. </html>