📄 profile6.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/04/03 16:05:07">
<title>7.3.2 Limitations of profiling results </title>
<STYLE TYPE="text/css">
<!--
span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>
<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="profile5.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="profile7.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<h3>
<a name="1204496"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">7.3.2 Limitations of profiling results</font>
</h3>
<p>
<a name="1204497"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Profiling data should be interpreted with care. In particular the following points should be noted.</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204498"> </a>Profiling reduces execution speed on the simulator.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204499"> </a>Sample profiling is prone to sampling errors.</font></p>
<dl>
<dt> <a name="1204500"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">When sampling is used, inaccuracies are possible, especially if the application does not run for very long. The results should always be treated as estimates. For hardware targets the profiler performs flat profiling using a sampling method. On the simulator, data for flat profiling is recorded after each instruction is executed and so it does not incur this sampling error.</font>
</dl>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204501"> </a>Idle profiling and flat profiling can be used concurrently, but the two facilities would have to share the same host/target connection, thereby reducing each facility's sampling frequency by at least fifty per cent.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204502"> </a>If input/output is being performed, the profiler may indicate many hits to the inform mechanism installed by the debugger; this is described in the <em>ST20 Embedded Toolset User Manual</em>, chapter <em>st20run tool</em>.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204506"> </a>The CPU to Diagnostic Controller Unit interface allows the DCU to sample the <span class=Signal>Iptr</span> part way through the execution of an instruction. If the profiler does this part way through the execution of a <font size=2 face=Courier><strong>ret</strong></font> instruction then the value of <span class=Signal>Iptr</span> becomes the address of the instruction following the <font size=2 face=Courier><strong>ret</strong></font>. If this <font size=2 face=Courier><strong>ret</strong></font> is the exit from the bottom of a function then the <span class=Signal>Iptr</span> may contain the address of the next function. The profiler then counts this sample as falling within the next function. This type of sampling error is most likely to occur in short functions.</font></p>
<dl>
<dt> <a name="1209020"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">One work around for this problem is to add an explicit <font size=2 face=Courier><strong>return</strong></font> statement at the end of a function, and after the <font size=2 face=Courier><strong>return</strong></font> add a dummy statement. For example:</font>
<dt> <a name="1209022"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif"><font size=2 face=Courier><strong>void sub1(int val)<br>{<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -