⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 profile.sgml

📁 eCos操作系统源码
💻 SGML
字号:
<PART ID="services-profile-gprof"><TITLE>Application profiling</TITLE><PARTINTRO><PARA>The profile_gprof package provides a mechanism to measure theruntime performance of an application.  This is done by gatheringan execution histogram.</PARA><para>When profiling is started on the target device, a <function>TFTP</function> server will be startedwhich exports the single file<filename>PROFILE.DAT</filename>This analysis data can then be fetchedby connecting to the target with a <function>TFTP</function> client programand then be processed by the <function>gprof</function>utility program.<note><title>NOTE</title><para>Be sure and specify binary mode transfers for this data file,which may not be the default with on some <function>TFTP</function>client programs.</para></note><note><title>NOTE</title><para>The port used for this <function>TFTP</function> server isconfigurable.  The default will be the IETF standard portof 69/UDP, but it may be changed to any UDP port via the<literal>CYGNUM_PROFILE_TFTP_PORT</literal> CDL option.</para></note></para></PARTINTRO><CHAPTER id="profile-functions"><TITLE>Profiling functions</TITLE><SECT1 id="services-profile-api"><title> API </title><para>In order for profile data to be gathered for an application, theprogram has to initiate the process.Once started, execution histogram data will be collected in adynamic memory buffer.This data can be uploaded to a host using <emphasis>TFTP</emphasis>.A side effect of the upload of the data is that the histogramis reset.This is useful, especially for high resolution histograms, sincethe histogram data are collected as 16-bit counters which can be quicklysaturated.For example, if the histogram is being collected at a rate of 10,000samples per second, a hot spot in the program could saturate afteronly 6.5 seconds.</para><para> The API for the application profiling functions can befound in the file <filename>&lt;cyg/profile/profile.h&gt;</filename>.</para><sect2 id="services-profile-api-profile-on"><title>profile_on</title><para>This function is used to initiate the gathering of theruntime execution histogram data.</para><programlisting>void profile_on(void *start, void *end, int bucket_size, int resolution);</programlisting><para>Calling this function will initiate execution profiling.An execution histogram is collected at the rate of<parameter>resolution</parameter> times per second.The area between <parameter>start</parameter> and <parameter>end</parameter>will be divided up into a number of buckets, each representing <parameter>bucket_size</parameter> program bytes in length.  Using statistical sampling (via a high speed timer), whenthe program counter is found to be within the range <parameter>start</parameter>..<parameter>end</parameter>, the appropriatebucket (histogram entry) will be incremented.</para><para>The choice of <parameter>resolution</parameter> and <parameter>bucket_size</parameter>control how large the data gathered will be, as well as how much overhead is encumbered for gathering the histogram.Smaller values for <parameter>bucket_size</parameter> will garner betterresults (<function>gprof</function> can more closely align the data withactual function names) at the expense of a larger data buffer.</para><note><title>NOTE</title><para>The value of <parameter>bucket_size</parameter> will be rounded up to a power of two.</para></note></sect2></SECT1></CHAPTER></PART>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -