Changeset 862

Show
Ignore:
Timestamp:
12/12/09 21:46:40 (3 years ago)
Author:
atorf
Message:

NXCProfiler: Nice version with more stats and new example!

Location:
branches/atorf/personal playground/NXCProfiler
Files:
6 added
1 modified

Legend:

Unmodified
Added
Removed
  • branches/atorf/personal playground/NXCProfiler/Analyzer/AnalyzeNXCProfile.py

    r861 r862  
    313313 
    314314        if (stats.ExecutionsSameMs[sectionNo] > 0): 
    315             parts.append('<td class="codeprofiledtimetd" align="center">&nbsp;<br>&nbsp;<br><b>&gt; %.3f s (%.0f%%)</b><br><br>+ %d calls &lt; 1ms</td>' % (stats.ElapsedTicks[sectionNo]/1000.0, stats.ElapsedTicks[sectionNo]/stats.ProfiledRunTime*100, stats.ExecutionsSameMs[sectionNo])) 
     315            parts.append('<td class="codeprofiledtimetd" align="center">&nbsp;<br>&nbsp;<br><b>&gt; %.3f s (%.0f%%)</b><br><br>by %d%% of the calls</td>' % (stats.ElapsedTicks[sectionNo]/1000.0, stats.ElapsedTicks[sectionNo]/stats.ProfiledRunTime*100, (1-(stats.ExecutionsSameMs[sectionNo]/stats.ExecutionCount[sectionNo]))*100)) 
    316316        else: 
    317317            parts.append('<td class="codeprofiledtimetd" align="center"><b>&gt; %.3f s (%.0f%%)</b></td>' % (stats.ElapsedTicks[sectionNo]/1000.0, stats.ElapsedTicks[sectionNo]/stats.ProfiledRunTime*100)) 
    318318        #end if 
    319319         
    320         maxmspercall = stats.ElapsedTicks[sectionNo] / stats.ExecutionCount[sectionNo]  
    321         if maxmspercall < 1: 
    322             percallstr = "&lt; 1.0 ms ?" 
     320     
     321        maxmspercall = stats.ElapsedTicks[sectionNo] / stats.ExecutionCount[sectionNo] 
     322        if (stats.ExecutionsSameMs[sectionNo] > 0): 
     323            sameMsPerc = stats.ExecutionsSameMs[sectionNo] / stats.ExecutionCount[sectionNo] * 100 
     324            tickedPerc = 100 - sameMsPerc 
     325            if stats.ExecutionCount[sectionNo] ==  stats.ExecutionsSameMs[sectionNo]: 
     326                parts.append('<td class="codeprofiledmspercalltd" align="center"><b>&lt; 1 ms </b></td>') 
     327            else: 
     328                tickedAvgPerCall = stats.ElapsedTicks[sectionNo] / (stats.ExecutionCount[sectionNo] - stats.ExecutionsSameMs[sectionNo]) 
     329                perc1str = ('%2d' % tickedPerc).replace(' ', '&nbsp;') 
     330                perc2str = ('%2d' % sameMsPerc).replace(' ', '&nbsp;') 
     331                parts.append('<td class="codeprofiledmspercalltd" align="center">&nbsp;<br>&nbsp;<br>&gt; %.1f ms (in %s%%)<br><br>&lt; 1.0 ms (in %s%%)</td>' % (tickedAvgPerCall, perc1str, perc2str)) 
     332            #end if 
    323333        else: 
    324             percallstr = "&gt; %.1f ms" % maxmspercall 
    325         #end if 
    326         parts.append('<td class="codeprofiledmspercalltd" align="center">%s</td>' % percallstr) 
     334              
     335            if maxmspercall < 1: 
     336                percallstr = "&lt; 1.0 ms ?" 
     337            else: 
     338                percallstr = "<b>&gt; %.1f ms</b>" % maxmspercall 
     339            #end if 
     340            parts.append('<td class="codeprofiledmspercalltd" align="center">%s</td>' % percallstr) 
     341         
    327342         
    328343