Commit 44f2a4a3 by Maxime Chéramy

Update documentation and add a script example.

parent 52ad6d54
...@@ -43,16 +43,16 @@ master_doc = 'index' ...@@ -43,16 +43,16 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'SimSo' project = u'SimSo'
copyright = u'2013, Maxime Chéramy' copyright = u'2013-2015, Maxime Chéramy'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.1' version = '0.8'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.1' release = '0.8'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
......
# Sphinx build info version 1 # Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0f051803cb376160792863ce353e53c6 config: 8d6238250f69b97f9d900e69d2ee510c
tags: 645f666f9bcd5a90fca523b33c5a78b7 tags: 645f666f9bcd5a90fca523b33c5a78b7
...@@ -11,7 +11,7 @@ Loading a configuration using a simulation file ...@@ -11,7 +11,7 @@ Loading a configuration using a simulation file
A :class:`Configuration <simso.configuration.Configuration>` can be initialized with a file passed to its constructor:: A :class:`Configuration <simso.configuration.Configuration>` can be initialized with a file passed to its constructor::
configuration = Configuration(argv[0]) configuration = Configuration(argv[1])
The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the :meth:`check_all <simso.configuration.Configuration.check_all>` method:: The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the :meth:`check_all <simso.configuration.Configuration.check_all>` method::
...@@ -37,10 +37,14 @@ And of course processors:: ...@@ -37,10 +37,14 @@ And of course processors::
configuration.add_processor(name="CPU 1", identifier=1) configuration.add_processor(name="CPU 1", identifier=1)
Finally, a scheduler is also required:: Finally, a scheduler is also required. For that, it's possible to use a custom scheduler::
configuration.scheduler_info.filename = "examples/RM.py"
Or one of the schedulers embedded with SimSo::
configuration.scheduler_info.clas = "simso.schedulers.RM"
configuration.scheduler_info.set_name("examples/RM.py",
configuration.cur_dir)
Creating the Model Creating the Model
------------------ ------------------
...@@ -67,10 +71,11 @@ The following script simulate a system loading from a simulation file or configu ...@@ -67,10 +71,11 @@ The following script simulate a system loading from a simulation file or configu
from simso.core import Model from simso.core import Model
from simso.configuration import Configuration from simso.configuration import Configuration
def main(argv): def main(argv):
if len(argv) == 1: if len(argv) == 2:
# Configuration load from a file. # Configuration load from a file.
configuration = Configuration(argv[0]) configuration = Configuration(argv[1])
else: else:
# Manual configuration: # Manual configuration:
configuration = Configuration() configuration = Configuration()
...@@ -89,8 +94,8 @@ The following script simulate a system loading from a simulation file or configu ...@@ -89,8 +94,8 @@ The following script simulate a system loading from a simulation file or configu
configuration.add_processor(name="CPU 1", identifier=1) configuration.add_processor(name="CPU 1", identifier=1)
# Add a scheduler: # Add a scheduler:
configuration.scheduler_info.set_name("examples/RM.py", #configuration.scheduler_info.filename = "examples/RM.py"
configuration.cur_dir) configuration.scheduler_info.clas = "simso.schedulers.RM"
# Check the config before trying to run it. # Check the config before trying to run it.
configuration.check_all() configuration.check_all()
...@@ -105,6 +110,8 @@ The following script simulate a system loading from a simulation file or configu ...@@ -105,6 +110,8 @@ The following script simulate a system loading from a simulation file or configu
for log in model.logs: for log in model.logs:
print(log) print(log)
main(sys.argv)
More details More details
------------ ------------
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
...@@ -238,10 +238,6 @@ ...@@ -238,10 +238,6 @@
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl> <td style="width: 33%" valign="top"><dl>
<dt><a href="modules.html#simso.core.Scheduler.SchedulerInfo.filename">filename (SchedulerInfo attribute)</a>
</dt>
<dt><a href="modules.html#simso.utils.PartitionedScheduler.first_fit">first_fit() (in module simso.utils.PartitionedScheduler)</a> <dt><a href="modules.html#simso.utils.PartitionedScheduler.first_fit">first_fit() (in module simso.utils.PartitionedScheduler)</a>
</dt> </dt>
...@@ -424,12 +420,6 @@ ...@@ -424,12 +420,6 @@
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl> <td style="width: 33%" valign="top"><dl>
<dt><a href="modules.html#simso.core.Scheduler.SchedulerInfo.name">name (SchedulerInfo attribute)</a>
</dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules.html#simso.utils.PartitionedScheduler.next_fit">next_fit() (in module simso.utils.PartitionedScheduler)</a> <dt><a href="modules.html#simso.utils.PartitionedScheduler.next_fit">next_fit() (in module simso.utils.PartitionedScheduler)</a>
</dt> </dt>
...@@ -558,10 +548,6 @@ ...@@ -558,10 +548,6 @@
</dt> </dt>
<dt><a href="modules.html#simso.core.Scheduler.SchedulerInfo.set_name">set_name() (SchedulerInfo method)</a>
</dt>
<dt><a href="modules.html#simso.core.results.Results.set_observation_window">set_observation_window() (Results method)</a> <dt><a href="modules.html#simso.core.results.Results.set_observation_window">set_observation_window() (Results method)</a>
</dt> </dt>
...@@ -589,12 +575,12 @@ ...@@ -589,12 +575,12 @@
<dt><a href="modules.html#module-simso.core.Logger">simso.core.Logger (module)</a> <dt><a href="modules.html#module-simso.core.Logger">simso.core.Logger (module)</a>
</dt> </dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules.html#module-simso.core.Model">simso.core.Model (module)</a> <dt><a href="modules.html#module-simso.core.Model">simso.core.Model (module)</a>
</dt> </dt>
</dl></td>
<td style="width: 33%" valign="top"><dl>
<dt><a href="modules.html#module-simso.core.Processor">simso.core.Processor (module)</a> <dt><a href="modules.html#module-simso.core.Processor">simso.core.Processor (module)</a>
</dt> </dt>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
...@@ -212,7 +212,7 @@ It takes as argument the cpu on which the scheduler runs.</p> ...@@ -212,7 +212,7 @@ It takes as argument the cpu on which the scheduler runs.</p>
<dl class="class"> <dl class="class">
<dt id="simso.core.Scheduler.SchedulerInfo"> <dt id="simso.core.Scheduler.SchedulerInfo">
<em class="property">class </em><tt class="descname">SchedulerInfo</tt><big>(</big><em>name=''</em>, <em>cls=None</em>, <em>overhead=0</em>, <em>overhead_activate=0</em>, <em>overhead_terminate=0</em>, <em>fields=None</em><big>)</big><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo" title="Permalink to this definition"></a></dt> <em class="property">class </em><tt class="descname">SchedulerInfo</tt><big>(</big><em>clas=''</em>, <em>overhead=0</em>, <em>overhead_activate=0</em>, <em>overhead_terminate=0</em>, <em>fields=None</em><big>)</big><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo" title="Permalink to this definition"></a></dt>
<dd><p>SchedulerInfo groups the data that characterize a Scheduler (such as the <dd><p>SchedulerInfo groups the data that characterize a Scheduler (such as the
scheduling overhead) and do the dynamic loading of the scheduler.</p> scheduling overhead) and do the dynamic loading of the scheduler.</p>
<dl class="docutils"> <dl class="docutils">
...@@ -225,13 +225,6 @@ scheduling overhead) and do the dynamic loading of the scheduler.</p> ...@@ -225,13 +225,6 @@ scheduling overhead) and do the dynamic loading of the scheduler.</p>
</dd> </dd>
</dl> </dl>
<p>Methods:</p> <p>Methods:</p>
<dl class="attribute">
<dt id="simso.core.Scheduler.SchedulerInfo.filename">
<tt class="descname">filename</tt><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo.filename" title="Permalink to this definition"></a></dt>
<dd><p>Path of the scheduler (absolute or relative to simso&#8217;s working
directory).</p>
</dd></dl>
<dl class="method"> <dl class="method">
<dt id="simso.core.Scheduler.SchedulerInfo.get_cls"> <dt id="simso.core.Scheduler.SchedulerInfo.get_cls">
<tt class="descname">get_cls</tt><big>(</big><big>)</big><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo.get_cls" title="Permalink to this definition"></a></dt> <tt class="descname">get_cls</tt><big>(</big><big>)</big><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo.get_cls" title="Permalink to this definition"></a></dt>
...@@ -251,26 +244,6 @@ directory).</p> ...@@ -251,26 +244,6 @@ directory).</p>
</dl> </dl>
</dd></dl> </dd></dl>
<dl class="attribute">
<dt id="simso.core.Scheduler.SchedulerInfo.name">
<tt class="descname">name</tt><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo.name" title="Permalink to this definition"></a></dt>
<dd><p>The name of the Scheduler (its relative path to the XML).</p>
</dd></dl>
<dl class="method">
<dt id="simso.core.Scheduler.SchedulerInfo.set_name">
<tt class="descname">set_name</tt><big>(</big><em>filename</em>, <em>cur_dir=None</em><big>)</big><a class="headerlink" href="#simso.core.Scheduler.SchedulerInfo.set_name" title="Permalink to this definition"></a></dt>
<dd><p>Set the scheduler from a file.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><ul class="first last simple">
<li><cite>filename</cite>: relative path to the Python source containing the Scheduler.</li>
<li><cite>cur_dir</cite>: current directory. Used to set the name relatively to the simulation file.</li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl> </dd></dl>
</div> </div>
......
No preview for this file type
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<div class="section" id="loading-a-configuration-using-a-simulation-file"> <div class="section" id="loading-a-configuration-using-a-simulation-file">
<h2><a class="toc-backref" href="#id2">Loading a configuration using a simulation file</a><a class="headerlink" href="#loading-a-configuration-using-a-simulation-file" title="Permalink to this headline"></a></h2> <h2><a class="toc-backref" href="#id2">Loading a configuration using a simulation file</a><a class="headerlink" href="#loading-a-configuration-using-a-simulation-file" title="Permalink to this headline"></a></h2>
<p>A <a class="reference internal" href="modules.html#module-simso.configuration.Configuration" title="simso.configuration.Configuration"><tt class="xref py py-class docutils literal"><span class="pre">Configuration</span></tt></a> can be initialized with a file passed to its constructor:</p> <p>A <a class="reference internal" href="modules.html#module-simso.configuration.Configuration" title="simso.configuration.Configuration"><tt class="xref py py-class docutils literal"><span class="pre">Configuration</span></tt></a> can be initialized with a file passed to its constructor:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
</pre></div> </pre></div>
</div> </div>
<p>The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the <tt class="xref py py-meth docutils literal"><span class="pre">check_all</span></tt> method:</p> <p>The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the <tt class="xref py py-meth docutils literal"><span class="pre">check_all</span></tt> method:</p>
...@@ -96,9 +96,12 @@ ...@@ -96,9 +96,12 @@
<div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span><span class="o">.</span><span class="n">add_processor</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;CPU 1&quot;</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span><span class="o">.</span><span class="n">add_processor</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;CPU 1&quot;</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
<p>Finally, a scheduler is also required:</p> <p>Finally, a scheduler is also required. For that, it&#8217;s possible to use a custom scheduler:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span><span class="o">.</span><span class="n">scheduler_info</span><span class="o">.</span><span class="n">set_name</span><span class="p">(</span><span class="s">&quot;examples/RM.py&quot;</span><span class="p">,</span> <div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span><span class="o">.</span><span class="n">scheduler_info</span><span class="o">.</span><span class="n">filename</span> <span class="o">=</span> <span class="s">&quot;examples/RM.py&quot;</span>
<span class="n">configuration</span><span class="o">.</span><span class="n">cur_dir</span><span class="p">)</span> </pre></div>
</div>
<p>Or one of the schedulers embedded with SimSo:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">configuration</span><span class="o">.</span><span class="n">scheduler_info</span><span class="o">.</span><span class="n">clas</span> <span class="o">=</span> <span class="s">&quot;simso.schedulers.RM&quot;</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
...@@ -125,10 +128,11 @@ ...@@ -125,10 +128,11 @@
<span class="kn">from</span> <span class="nn">simso.core</span> <span class="kn">import</span> <span class="n">Model</span> <span class="kn">from</span> <span class="nn">simso.core</span> <span class="kn">import</span> <span class="n">Model</span>
<span class="kn">from</span> <span class="nn">simso.configuration</span> <span class="kn">import</span> <span class="n">Configuration</span> <span class="kn">from</span> <span class="nn">simso.configuration</span> <span class="kn">import</span> <span class="n">Configuration</span>
<span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="p">):</span> <span class="k">def</span> <span class="nf">main</span><span class="p">(</span><span class="n">argv</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="c"># Configuration load from a file.</span> <span class="c"># Configuration load from a file.</span>
<span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span> <span class="k">else</span><span class="p">:</span>
<span class="c"># Manual configuration:</span> <span class="c"># Manual configuration:</span>
<span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">()</span> <span class="n">configuration</span> <span class="o">=</span> <span class="n">Configuration</span><span class="p">()</span>
...@@ -147,8 +151,8 @@ ...@@ -147,8 +151,8 @@
<span class="n">configuration</span><span class="o">.</span><span class="n">add_processor</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;CPU 1&quot;</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="n">configuration</span><span class="o">.</span><span class="n">add_processor</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&quot;CPU 1&quot;</span><span class="p">,</span> <span class="n">identifier</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="c"># Add a scheduler:</span> <span class="c"># Add a scheduler:</span>
<span class="n">configuration</span><span class="o">.</span><span class="n">scheduler_info</span><span class="o">.</span><span class="n">set_name</span><span class="p">(</span><span class="s">&quot;examples/RM.py&quot;</span><span class="p">,</span> <span class="c">#configuration.scheduler_info.filename = &quot;examples/RM.py&quot;</span>
<span class="n">configuration</span><span class="o">.</span><span class="n">cur_dir</span><span class="p">)</span> <span class="n">configuration</span><span class="o">.</span><span class="n">scheduler_info</span><span class="o">.</span><span class="n">clas</span> <span class="o">=</span> <span class="s">&quot;simso.schedulers.RM&quot;</span>
<span class="c"># Check the config before trying to run it.</span> <span class="c"># Check the config before trying to run it.</span>
<span class="n">configuration</span><span class="o">.</span><span class="n">check_all</span><span class="p">()</span> <span class="n">configuration</span><span class="o">.</span><span class="n">check_all</span><span class="p">()</span>
...@@ -162,6 +166,8 @@ ...@@ -162,6 +166,8 @@
<span class="c"># Print logs.</span> <span class="c"># Print logs.</span>
<span class="k">for</span> <span class="n">log</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">logs</span><span class="p">:</span> <span class="k">for</span> <span class="n">log</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">logs</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">log</span><span class="p">)</span> <span class="k">print</span><span class="p">(</span><span class="n">log</span><span class="p">)</span>
<span class="n">main</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<script type="text/javascript"> <script type="text/javascript">
var DOCUMENTATION_OPTIONS = { var DOCUMENTATION_OPTIONS = {
URL_ROOT: './', URL_ROOT: './',
VERSION: '0.1', VERSION: '0.8',
COLLAPSE_INDEX: false, COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html', FILE_SUFFIX: '.html',
HAS_SOURCE: true HAS_SOURCE: true
......
...@@ -11,7 +11,7 @@ Loading a configuration using a simulation file ...@@ -11,7 +11,7 @@ Loading a configuration using a simulation file
A :class:`Configuration <simso.configuration.Configuration>` can be initialized with a file passed to its constructor:: A :class:`Configuration <simso.configuration.Configuration>` can be initialized with a file passed to its constructor::
configuration = Configuration(argv[0]) configuration = Configuration(argv[1])
The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the :meth:`check_all <simso.configuration.Configuration.check_all>` method:: The configuration could also be partial and completed by the script. Finally, the configuration can be checked for correctness using the :meth:`check_all <simso.configuration.Configuration.check_all>` method::
...@@ -37,10 +37,14 @@ And of course processors:: ...@@ -37,10 +37,14 @@ And of course processors::
configuration.add_processor(name="CPU 1", identifier=1) configuration.add_processor(name="CPU 1", identifier=1)
Finally, a scheduler is also required:: Finally, a scheduler is also required. For that, it's possible to use a custom scheduler::
configuration.scheduler_info.filename = "examples/RM.py"
Or one of the schedulers embedded with SimSo::
configuration.scheduler_info.clas = "simso.schedulers.RM"
configuration.scheduler_info.set_name("examples/RM.py",
configuration.cur_dir)
Creating the Model Creating the Model
------------------ ------------------
...@@ -67,10 +71,11 @@ The following script simulate a system loading from a simulation file or configu ...@@ -67,10 +71,11 @@ The following script simulate a system loading from a simulation file or configu
from simso.core import Model from simso.core import Model
from simso.configuration import Configuration from simso.configuration import Configuration
def main(argv): def main(argv):
if len(argv) == 1: if len(argv) == 2:
# Configuration load from a file. # Configuration load from a file.
configuration = Configuration(argv[0]) configuration = Configuration(argv[1])
else: else:
# Manual configuration: # Manual configuration:
configuration = Configuration() configuration = Configuration()
...@@ -89,8 +94,8 @@ The following script simulate a system loading from a simulation file or configu ...@@ -89,8 +94,8 @@ The following script simulate a system loading from a simulation file or configu
configuration.add_processor(name="CPU 1", identifier=1) configuration.add_processor(name="CPU 1", identifier=1)
# Add a scheduler: # Add a scheduler:
configuration.scheduler_info.set_name("examples/RM.py", #configuration.scheduler_info.filename = "examples/RM.py"
configuration.cur_dir) configuration.scheduler_info.clas = "simso.schedulers.RM"
# Check the config before trying to run it. # Check the config before trying to run it.
configuration.check_all() configuration.check_all()
...@@ -105,6 +110,8 @@ The following script simulate a system loading from a simulation file or configu ...@@ -105,6 +110,8 @@ The following script simulate a system loading from a simulation file or configu
for log in model.logs: for log in model.logs:
print(log) print(log)
main(sys.argv)
More details More details
------------ ------------
......
#!/usr/bin/python3
"""
Example of a script that uses SimSo.
"""
import sys
from simso.core import Model
from simso.configuration import Configuration
def main(argv):
if len(argv) == 2:
# Configuration load from a file.
configuration = Configuration(argv[1])
else:
# Manual configuration:
configuration = Configuration()
configuration.duration = 420 * configuration.cycles_per_ms
# Add tasks:
configuration.add_task(name="T1", identifier=1, period=7,
activation_date=0, wcet=3, deadline=7)
configuration.add_task(name="T2", identifier=2, period=12,
activation_date=0, wcet=3, deadline=12)
configuration.add_task(name="T3", identifier=3, period=20,
activation_date=0, wcet=5, deadline=20)
# Add a processor:
configuration.add_processor(name="CPU 1", identifier=1)
# Add a scheduler:
#configuration.scheduler_info.filename = "../simso/schedulers/RM.py"
configuration.scheduler_info.clas = "simso.schedulers.RM"
# Check the config before trying to run it.
configuration.check_all()
# Init a model from the configuration.
model = Model(configuration)
# Execute the simulation.
model.run_model()
# Print logs.
for log in model.logs:
print(log)
main(sys.argv)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment