<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:Monospaced;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:866255974;
mso-list-type:hybrid;
mso-list-template-ids:-1332675244 1973726340 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:20.25pt;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:56.25pt;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:92.25pt;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:128.25pt;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:164.25pt;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:200.25pt;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:236.25pt;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:272.25pt;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:308.25pt;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello Samuel, hello all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As a reminder and behind the introduction of profile-prefixed functions the idea is to implement functions similar to the ones available within Scilab-5 to:<o:p></o:p></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
instrument a specific function<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
get the counters in a Scilab structure<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:-15.75pt;mso-list:l0 level1 lfo1">
de-instrument a specific function<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So depending on your use you can covStart()/profileEnable() then profileGetInfo() then covStop() /profileDisable() to retrieve information about your execution. covStart() will clear previous instrumented information whereas profileEnable()
allow to append functions (same difference between covStop() and profileDisable()). In term of arguments, covStart() allow string arguments (function names) whereas profileEnable() only take functions or libraries.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">About numbers, well I think you get it right and I agree the lines 2,3 and 4 are not obvious ; there might be a bug there. 638ms for getting / setting a double scalar is not correct as well as the cumulated time `sum( prof(4)(1), 'r')`
does not look like being in seconds (as stated in the documentation).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Clément<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> users <users-bounces@lists.scilab.org> <b>On Behalf Of
</b>Samuel Gougeon<br>
<b>Sent:</b> Thursday, January 28, 2021 2:44 PM<br>
<b>To:</b> International users mailing list for Scilab. <users@lists.scilab.org><br>
<b>Subject:</b> [Scilab-users] How to read profileGetInfo().LineCoverage results correctly?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-family:"Arial",sans-serif">Dear all,</span><o:p></o:p></p>
<p><span style="font-family:"Arial",sans-serif">Still about new Scilab 6 profiling capabilities:<br>
The first so-called ""Basic example" given in the documentation of the profiling features
<br>
@ <a href="https://help.scilab.org/docs/6.1.0/en_US/profile.html">https://help.scilab.org/docs/6.1.0/en_US/profile.html</a> is the following:</span><o:p></o:p></p>
<pre><i><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#64AE64">// Function to be profiled</span></i><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#B01813">function</span><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <b><span style="color:#834310">x</span></b><span style="color:#5C5C5C">=</span><u><span style="color:black">foo</span></u><span style="color:#4A55DB">(</span><b><span style="color:#834310">n</span></b><span style="color:#4A55DB">)</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#A020F0">if</span> <b><span style="color:#834310">n</span></b> <span style="color:#5C5C5C">></span> <span style="color:rosybrown">0</span> <span style="color:#A020F0">then</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <b><span style="color:#834310">x</span></b> <span style="color:#5C5C5C">=</span> <span style="color:rosybrown">0</span><span style="color:black">;</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#A020F0">for</span> <span style="color:black">k</span> <span style="color:#5C5C5C">=</span> <span style="color:rosybrown">1</span><span style="color:#FFAA00">:</span><b><span style="color:#834310">n</span></b><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:black">s</span> <span style="color:#5C5C5C">=</span> <span style="color:#32B9B9">svd</span><span style="color:#4A55DB">(</span><span style="color:#32B9B9">rand</span><span style="color:#4A55DB">(</span><b><span style="color:#834310">n</span></b><span style="color:black">,</span> <b><span style="color:#834310">n</span></b><span style="color:#4A55DB">))</span><span style="color:black">;</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <b><span style="color:#834310">x</span></b> <span style="color:#5C5C5C">=</span> <b><span style="color:#834310">x</span></b> <span style="color:#5C5C5C">+</span> <span style="color:black">s</span><span style="color:#4A55DB">(</span><span style="color:rosybrown">1</span><span style="color:#4A55DB">)</span><span style="color:black">;</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#A020F0">end</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#A020F0">else</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <b><span style="color:#834310">x</span></b> <span style="color:#5C5C5C">=</span> <span style="color:#4A55DB">[]</span><span style="color:black">;</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#A020F0">end</span><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#B01813">endfunction</span><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p> </o:p></span></pre>
<pre><i><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#64AE64">// Enables the profiling of the function</span></i><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#32B9B9">profileEnable</span><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB">(</span><u><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:black">foo</span></u><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB">)</span><span style="font-size:10.5pt;font-family:"Monospaced",serif">;<o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p> </o:p></span></pre>
<pre><i><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#64AE64">// Executes the function</span></i><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><u><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:black">foo</span></u><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB">(</span><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:rosybrown">200</span><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB">)</span><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:black">;</span><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p> </o:p></span></pre>
<pre><i><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#64AE64">// Returns the function profiling results</span></i><span style="font-size:10.5pt;font-family:"Monospaced",serif"><o:p></o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:black">prof</span><span style="font-size:10.5pt;font-family:"Monospaced",serif"> <span style="color:#5C5C5C">=</span> <span style="color:#32B9B9">profileGetInfo</span><span style="color:#4A55DB">();<o:p></o:p></span></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB"><o:p> </o:p></span></pre>
<pre><span style="font-size:10.5pt;font-family:"Monospaced",serif;color:#4A55DB"><o:p> </o:p></span></pre>
<p>Now, after <a href="https://help.scilab.org/docs/6.1.0/en_US/profileGetInfo.html">
https://help.scilab.org/docs/6.1.0/en_US/profileGetInfo.html</a> we can get <br>
--> prof.LineCoverage(1)<br>
ans =<br>
-1. 0. // function ...<br>
1. <span style="color:#FF8040">0.6385544</span> // if ...
<b>Why so long time ??</b><br>
1. <span style="color:#FF8040">0.6385513 </span> // x = 0; 638 ms for a single execution ??<br>
1. <span style="color:#FF8040">0.6385467 </span> // idem<br>
200. 1.2763477 // OK, quite expected. The strange thing is that the "x=0" time is almost the half of this time..<br>
200. 0.0005116 // OK, a result more understandable than for x=0 above.<br>
-1. 0. // OK (end for)<br>
-1. 0. // OK (else)<br>
0. 0. // OK : never met<br>
-1. 0. <br>
-1. 0. <br>
<br>
Since it is presented as a basic example, it is likely error-proof.<br>
So what am i missing about how to read or interpret these results ?<o:p></o:p></p>
<p style="margin-bottom:12.0pt">Thanks for any clarification. Without it, it quite hard to trust and use this important tool.<br>
Best regards<br>
Samuel Gougeon<o:p></o:p></p>
</div>
</body>
</html>