<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">Hi there,<br><br>The help page on timer() function says<br>----------------------------------<br><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">Returns the CPU time since the preceding call to<span class="Apple-converted-space"> </span><code class="literal" style="font-size: 13px;">timer()</code>.</font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">timer has a time precision of 100 nanoseconds.</font></p><table style="color: rgb(0, 0, 0); font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><tbody><tr><td valign="top"><img src="https://help.scilab.org/docs/6.0.0/en_US/ScilabNote.png"></td><td valign="top"><div class="note">NOTE: CPU time is the number of processor cycles used for a computation. This is not at all equivalent to real-world time.</div></td></tr></tbody></table><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">CPU time can be used to compare CPU usage between different programs or functions , irrespective of background processes that might slow down the computer.</font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">--------------------------------------------<br></font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">1) timer() measures vary each time you run a program with the same data (see example below); how can it be this way, if the number of processor cycles is the same?<br></font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">2) if timer() results are not at all equivalent do real-world time, how can its precision be given by nanoseconds?</font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">3) how can the number of processor cycles be a fraction?<br></font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">Thanks for help.<br></font></p><p class="para" style="font-family: sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font color="#000000">Osvaldo<br></font></p><pre style="font-family:Monospaced;font-style:normal;font-size:11.0;"><font color="#000000">n</font> <font color="#5c5c5c">=</font> <font color="#bc8f8f">1000</font>
<font color="#000000">A</font> <font color="#5c5c5c">=</font> <font color="#bc8f8f">1</font> <font color="#5c5c5c">+</font> <font color="#32b9b9">rand</font><font color="#4a55db">(</font><font color="#000000">n</font><font color="#000000">,</font><font color="#000000">n</font><font color="#4a55db">)</font>
<font color="#000000">B_loop</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">zeros</font><font color="#4a55db">(</font><font color="#000000">A</font><font color="#4a55db">)</font>
<font color="#32b9b9">timer</font><font color="#4a55db">(</font><font color="#4a55db">)</font>
<font color="#a020f0">for</font> <font color="#000000">i</font> <font color="#5c5c5c">=</font> <font color="#bc8f8f">1</font><font color="#ffaa00">:</font><font color="#000000">n</font>
<font color="#a020f0">for</font> <font color="#000000">j</font> <font color="#5c5c5c">=</font> <font color="#bc8f8f">1</font><font color="#ffaa00">:</font><font color="#000000">n</font>
<font color="#000000">B_loop</font><font color="#4a55db">(</font><font color="#000000">i</font><font color="#000000">,</font><font color="#000000">j</font><font color="#4a55db">)</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">log</font><font color="#4a55db">(</font><font color="#000000">A</font><font color="#4a55db">(</font><font color="#000000">i</font><font color="#000000">,</font><font color="#000000">j</font><font color="#4a55db">)</font><font color="#4a55db">)</font>
<font color="#a020f0">end</font>
<font color="#a020f0">end</font>
<font color="#000000">time_loop</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">timer</font><font color="#4a55db">(</font><font color="#4a55db">)</font>
<font color="#000000">B_vec</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">zeros</font><font color="#4a55db">(</font><font color="#000000">A</font><font color="#4a55db">)</font>
<font color="#32b9b9">timer</font><font color="#4a55db">(</font><font color="#4a55db">)</font>
<font color="#000000">B_vec</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">log</font><font color="#4a55db">(</font><font color="#000000">A</font><font color="#4a55db">)</font>
<font color="#000000">time_vec</font> <font color="#5c5c5c">=</font> <font color="#32b9b9">timer</font><font color="#4a55db">(</font><font color="#4a55db">)</font>
<font color="#32b9b9">printf</font><font color="#4a55db">(</font><font color="#bc8f8f">"</font><font color="#bc8f8f">\ntime_loop = %12.10E, time_vec = %12.10E, ratio = %5.2f</font><font color="#bc8f8f">"</font><font color="#000000">,</font><font color="#000000">time_loop</font><font color="#000000">,</font><font color="#000000">time_vec</font><font color="#000000">,</font><font color="#000000">time_loop</font><font color="#5c5c5c">/</font><font color="#000000">time_vec</font><font color="#4a55db">)<br><br>------------------------<br>-->exec('C:\Users\Osvaldo\Dropbox\Estudos\Sistemas Eleitorais\setores_mg_bh\testeRenato.sce', -1)<br><br>time_loop = 4.3437500000E+00, time_vec = 1.5625000000E-02, ratio = 278.00 <br>-->exec('C:\Users\Osvaldo\Dropbox\Estudos\Sistemas Eleitorais\setores_mg_bh\testeRenato.sce', -1)<br><br>time_loop = 4.2656250000E+00, time_vec = 1.5625000000E-02, ratio = 273.00 <br></font></pre><div></div></font>