pypdevsbbl.tracers.FootprintTracer.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.FootprintTracer module &#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.PlotTracer module" href="pypdevsbbl.tracers.PlotTracer.html" />
  20. <link rel="prev" title="pypdevsbbl.tracers package" href="pypdevsbbl.tracers.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.PlotTracer.html" title="pypdevsbbl.tracers.PlotTracer module"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="pypdevsbbl.tracers.html" title="pypdevsbbl.tracers package"
  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" >pypdevsbbl package</a> &#187;</li>
  39. <li class="nav-item nav-item-2"><a href="pypdevsbbl.tracers.html" accesskey="U">pypdevsbbl.tracers package</a> &#187;</li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body" role="main">
  46. <div class="section" id="module-pypdevsbbl.tracers.FootprintTracer">
  47. <span id="pypdevsbbl-tracers-footprinttracer-module"></span><h1>pypdevsbbl.tracers.FootprintTracer module<a class="headerlink" href="#module-pypdevsbbl.tracers.FootprintTracer" title="Permalink to this headline">¶</a></h1>
  48. <p>This file contains a tracer that can can gather the execution cost of a simulation.</p>
  49. <p>The execution cost is either measured at the input port(s) or the output port(s) of a
  50. block. For readability, choose one and keep it consistent whenever possible.</p>
  51. <dl class="class">
  52. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer">
  53. <em class="property">class </em><code class="descclassname">pypdevsbbl.tracers.FootprintTracer.</code><code class="descname">FootprintTracer</code><span class="sig-paren">(</span><em>uid</em>, <em>server</em>, <em>filename</em>, <em>name</em>, <em>mapping</em>, <em>full=True</em>, <em>cpi=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers/FootprintTracer.html#FootprintTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer" title="Permalink to this definition">¶</a></dt>
  54. <dd><p>Bases: <a class="reference internal" href="pypdevsbbl.tracers.html#pypdevsbbl.tracers.BaseTracer" title="pypdevsbbl.tracers.BaseTracer"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.tracers.BaseTracer</span></code></a></p>
  55. <p>Gathers cost information of the simulation.</p>
  56. <p>The provided cost can be whatever is required in the current simulation.
  57. It can be the carbon footprint, the pricetag or even the amount of
  58. electricity. For this reason, multiple <a class="reference internal" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer" title="pypdevsbbl.tracers.FootprintTracer.FootprintTracer"><code class="xref py py-class docutils literal notranslate"><span class="pre">FootprintTracer</span></code></a> may be
  59. registered to the simulation. Give each <a class="reference internal" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer" title="pypdevsbbl.tracers.FootprintTracer.FootprintTracer"><code class="xref py py-class docutils literal notranslate"><span class="pre">FootprintTracer</span></code></a> a name
  60. to correctly associate the traced cost with the real-life consequences.</p>
  61. <table class="docutils field-list" frame="void" rules="none">
  62. <col class="field-name" />
  63. <col class="field-body" />
  64. <tbody valign="top">
  65. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
  66. <li><strong>uid</strong> – A unique identifier for distributed simulation.
  67. Will be set automatically.</li>
  68. <li><strong>server</strong> – The server that runs the distributed simulation.
  69. Will be set automatically.</li>
  70. <li><strong>filename</strong> (<em>str</em>) – The name of the file to write the results to.
  71. When <code class="docutils literal notranslate"><span class="pre">None</span></code>, all results will be written to the
  72. standard output.</li>
  73. <li><strong>name</strong> (<em>str</em>) – The name of the <a class="reference internal" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer" title="pypdevsbbl.tracers.FootprintTracer.FootprintTracer"><code class="xref py py-class docutils literal notranslate"><span class="pre">FootprintTracer</span></code></a>. Used to
  74. differentiate the results of different instances.</li>
  75. <li><strong>mapping</strong> (<em>dict</em>) – A mapping from a port of a building block to a
  76. number or a function that returns a number. This
  77. number represents the cost for each item that is
  78. inputted or outputted on that port. The function
  79. takes the item as an argument. E.g. an object with
  80. a weight of 60 kilograms might be more expensive
  81. when compared to an object that weighs 10 kilograms.</li>
  82. <li><strong>full</strong> (<em>bool</em>) – When <code class="docutils literal notranslate"><span class="pre">True</span></code>, output the full trace. Otherwise,
  83. only output the results.</li>
  84. <li><strong>cpi</strong> (<em>bool</em>) – Whether or not to print the cost per item at the
  85. end. These costs will be sorted with the largest
  86. cost first. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</li>
  87. </ul>
  88. </td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. <dl class="method">
  93. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer.startTracer">
  94. <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/FootprintTracer.html#FootprintTracer.startTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer.startTracer" title="Permalink to this definition">¶</a></dt>
  95. <dd></dd></dl>
  96. <dl class="method">
  97. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer.stopTracer">
  98. <code class="descname">stopTracer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers/FootprintTracer.html#FootprintTracer.stopTracer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer.stopTracer" title="Permalink to this definition">¶</a></dt>
  99. <dd></dd></dl>
  100. <dl class="method">
  101. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer.traceExternal">
  102. <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/FootprintTracer.html#FootprintTracer.traceExternal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer.traceExternal" title="Permalink to this definition">¶</a></dt>
  103. <dd><p>Traces all items arriving on input ports.</p>
  104. </dd></dl>
  105. <dl class="method">
  106. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer.traceInternal">
  107. <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/FootprintTracer.html#FootprintTracer.traceInternal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer.traceInternal" title="Permalink to this definition">¶</a></dt>
  108. <dd><p>Traces all items arriving on output ports.</p>
  109. </dd></dl>
  110. <dl class="method">
  111. <dt id="pypdevsbbl.tracers.FootprintTracer.FootprintTracer.total">
  112. <code class="descname">total</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/tracers/FootprintTracer.html#FootprintTracer.total"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.tracers.FootprintTracer.FootprintTracer.total" title="Permalink to this definition">¶</a></dt>
  113. <dd><p>Obtain the total footprint of the simulation.</p>
  114. </dd></dl>
  115. </dd></dl>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  121. <div class="sphinxsidebarwrapper">
  122. <h4>Previous topic</h4>
  123. <p class="topless"><a href="pypdevsbbl.tracers.html"
  124. title="previous chapter">pypdevsbbl.tracers package</a></p>
  125. <h4>Next topic</h4>
  126. <p class="topless"><a href="pypdevsbbl.tracers.PlotTracer.html"
  127. title="next chapter">pypdevsbbl.tracers.PlotTracer module</a></p>
  128. <div id="searchbox" style="display: none" role="search">
  129. <h3>Quick search</h3>
  130. <div class="searchformwrapper">
  131. <form class="search" action="search.html" method="get">
  132. <input type="text" name="q" />
  133. <input type="submit" value="Go" />
  134. <input type="hidden" name="check_keywords" value="yes" />
  135. <input type="hidden" name="area" value="default" />
  136. </form>
  137. </div>
  138. </div>
  139. <script type="text/javascript">$('#searchbox').show(0);</script>
  140. </div>
  141. </div>
  142. <div class="clearer"></div>
  143. </div>
  144. <div class="related" role="navigation" aria-label="related navigation">
  145. <h3>Navigation</h3>
  146. <ul>
  147. <li class="right" style="margin-right: 10px">
  148. <a href="genindex.html" title="General Index"
  149. >index</a></li>
  150. <li class="right" >
  151. <a href="py-modindex.html" title="Python Module Index"
  152. >modules</a> |</li>
  153. <li class="right" >
  154. <a href="pypdevsbbl.tracers.PlotTracer.html" title="pypdevsbbl.tracers.PlotTracer module"
  155. >next</a> |</li>
  156. <li class="right" >
  157. <a href="pypdevsbbl.tracers.html" title="pypdevsbbl.tracers package"
  158. >previous</a> |</li>
  159. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  160. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  161. <li class="nav-item nav-item-2"><a href="pypdevsbbl.tracers.html" >pypdevsbbl.tracers package</a> &#187;</li>
  162. </ul>
  163. </div>
  164. <div class="footer" role="contentinfo">
  165. &#169; Copyright 2020, Randy Paredis.
  166. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
  167. </div>
  168. </body>
  169. </html>