Login   Register  
PHP Classes
elePHPant
Icontem

File: example.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Zubov Ilya  >  Solace profiler  >  example.html  >  Download  
File: example.html
Role: Sample output
Content type: text/plain
Description: Profiler report
Class: Solace profiler
Profiler to analyse the time spent by a script
Author: By
Last change:
Date: 10 years ago
Size: 9,397 bytes
 

Contents

Class file image Download
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/* PROFILE for script example.php */<br />/* created 05/22/04 14:32:53 */<br /></span><span style="color: #0000BB">?&gt;<br />&lt;?php
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">include_once(</span><span style="color: #DD0000">'class.solace.profiler.php'</span><span style="color: #007700">);
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;&nbsp;&nbsp;2 00.72% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">declare(</span><span style="color: #0000BB">ticks</span><span style="color: #007700">=</span><span style="color: #0000BB">1</span><span style="color: #007700">);
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;&nbsp;&nbsp;1 00.08% */ </span><span style="color: #007700">include(</span><span style="color: #DD0000">'example_include.php'</span><span style="color: #007700">);
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">// This example does nothing, just a demonstration
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />/*&nbsp;&nbsp;&nbsp;&nbsp;1 00.08% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">; </span><span style="color: #FF8000">// direct assignment is the fastest operation
<br />/*&nbsp;&nbsp;&nbsp;&nbsp;1 00.08% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$b </span><span style="color: #007700">= </span><span style="color: #0000BB">20</span><span style="color: #007700">;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (</span><span style="color: #0000BB">$i </span><span style="color: #007700">= </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">&lt; </span><span style="color: #0000BB">100</span><span style="color: #007700">; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) { </span><span style="color: #FF8000">// 'for' is counted at the ending '}'
<br />/*&nbsp;&nbsp;100 07.45% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a </span><span style="color: #007700">= </span><span style="color: #0000BB">$a</span><span style="color: #007700">; </span><span style="color: #FF8000">// dummy, just to compare speed
<br />/*&nbsp;&nbsp;100 07.33% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$aa </span><span style="color: #007700">= &amp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">; </span><span style="color: #FF8000">// assigning and referencing takes the same time
<br />/*&nbsp;&nbsp;100 07.37% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">++;
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;100 08.25% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$b </span><span style="color: #007700">+= </span><span style="color: #0000BB">1</span><span style="color: #007700">; </span><span style="color: #FF8000">// this is usually a bit slower then $a++ (at least on my slow test PC)
<br />/*&nbsp;&nbsp;100 25.81% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">); </span><span style="color: #FF8000">// the main time-eater
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if (</span><span style="color: #0000BB">$c</span><span style="color: #007700">) {&nbsp;&nbsp;</span><span style="color: #FF8000">// 'if' is counted at the ending '}'
<br />/*&nbsp;&nbsp;&nbsp;40 04.44% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$f </span><span style="color: #007700">= @</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">, </span><span style="color: #DD0000">'r'</span><span style="color: #007700">);
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;&nbsp;40 03.21% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if (</span><span style="color: #0000BB">$f</span><span style="color: #007700">) </span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$f</span><span style="color: #007700">); </span><span style="color: #FF8000">// closing is faster then opening
<br />/*&nbsp;&nbsp;&nbsp;80 06.04% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">++;
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;&nbsp;40 02.90% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">}
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else </span><span style="color: #FF8000">// 'else' is counted at the ending '}'
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">{
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;&nbsp;60 04.41% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">++;
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;160 12.06% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">} </span><span style="color: #FF8000">// this line shows 160 (summary of 'else' and overall 'if' passes)
<br />/*&nbsp;&nbsp;101 09.76% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">} </span><span style="color: #FF8000">// 101 = 100 cycles + 1 initial php parser pass
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br /></span><span style="color: #0000BB">?&gt;
<br /></span>
</span>
</code><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/* PROFILE for script example_include.php */<br />/* created 05/22/04 14:32:53 */<br /></span><span style="color: #0000BB">?&gt;<br />&lt;?php
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">function </span><span style="color: #0000BB">test</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">) </span><span style="color: #FF8000">// declarations are not counted (no tick)
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">{
<br /></span><span style="color: #FF8000">/*&nbsp;&nbsp;100 97.66% */&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">$a </span><span style="color: #007700">- </span><span style="color: #0000BB">$b</span><span style="color: #007700">; </span><span style="color: #FF8000">// 100 cycles
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return </span><span style="color: #0000BB">$c </span><span style="color: #007700">&gt; </span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #FF8000">// 'return' doesn't produce a tick, so it is ignored
<br />/*&nbsp;&nbsp;&nbsp;&nbsp;1 01.26% */ </span><span style="color: #007700">}&nbsp;&nbsp;</span><span style="color: #FF8000">// 1 initial php parser pass
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br /></span><span style="color: #0000BB">?&gt;
<br /></span>
</span>
</code>