OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [profile/] [gprof/] [v2_0/] [doc/] [profile.sgml] - Diff between revs 27 and 174

Only display areas with differences | Details | Blame | View Log

Rev 27 Rev 174
Application profiling
Application profiling
The profile_gprof package provides a mechanism to measure the
The profile_gprof package provides a mechanism to measure the
runtime performance of an application.  This is done by gathering
runtime performance of an application.  This is done by gathering
an execution histogram.
an execution histogram.
When profiling is started on the target device, a
When profiling is started on the target device, a
TFTP
TFTP
server will be started
server will be started
which exports the single file
which exports the single file
PROFILE.DAT
PROFILE.DAT
This analysis data can then be fetched
This analysis data can then be fetched
by connecting to the target with a TFTP
by connecting to the target with a TFTP
client program
client program
and then be processed by the
and then be processed by the
gprof
gprof
utility program.
utility program.
NOTE
NOTE
Be sure and specify binary mode transfers for this data file,
Be sure and specify binary mode transfers for this data file,
which may not be the default with on some TFTP
which may not be the default with on some TFTP
client programs.
client programs.
NOTE
NOTE
The port used for this TFTP server is
The port used for this TFTP server is
configurable.  The default will be the IETF standard port
configurable.  The default will be the IETF standard port
of 69/UDP, but it may be changed to any UDP port via the
of 69/UDP, but it may be changed to any UDP port via the
CYGNUM_PROFILE_TFTP_PORT CDL option.
CYGNUM_PROFILE_TFTP_PORT CDL option.
Profiling functions
Profiling functions
 API 
 API 
In order for profile data to be gathered for an application, the
In order for profile data to be gathered for an application, the
program has to initiate the process.
program has to initiate the process.
Once started, execution histogram data will be collected in a
Once started, execution histogram data will be collected in a
dynamic memory buffer.
dynamic memory buffer.
This data can be uploaded to a host using TFTP.
This data can be uploaded to a host using TFTP.
A side effect of the upload of the data is that the histogram
A side effect of the upload of the data is that the histogram
is reset.
is reset.
This is useful, especially for high resolution histograms, since
This is useful, especially for high resolution histograms, since
the histogram data are collected as 16-bit counters which can be quickly
the histogram data are collected as 16-bit counters which can be quickly
saturated.
saturated.
For example, if the histogram is being collected at a rate of 10,000
For example, if the histogram is being collected at a rate of 10,000
samples per second, a hot spot in the program could saturate after
samples per second, a hot spot in the program could saturate after
only 6.5 seconds.
only 6.5 seconds.
 The API for the application profiling functions can be
 The API for the application profiling functions can be
found in the file <cyg/profile/profile.h>.
found in the file <cyg/profile/profile.h>.
profile_on
profile_on
This function is used to initiate the gathering of the
This function is used to initiate the gathering of the
runtime execution histogram data.
runtime execution histogram data.
void profile_on(void *start, void *end, int bucket_size, int resolution);
void profile_on(void *start, void *end, int bucket_size, int resolution);
Calling this function will initiate execution profiling.
Calling this function will initiate execution profiling.
An execution histogram is collected at the rate of
An execution histogram is collected at the rate of
resolution times per second.
resolution times per second.
The area between start and end
The area between start and end
will be divided up into a number of buckets, each representing
will be divided up into a number of buckets, each representing
bucket_size
bucket_size
program bytes in length.  Using statistical sampling (via a high speed timer), when
program bytes in length.  Using statistical sampling (via a high speed timer), when
the program counter is found to be within the range
the program counter is found to be within the range
start..end, the appropriate
start..end, the appropriate
bucket (histogram entry) will be incremented.
bucket (histogram entry) will be incremented.
The choice of resolution and bucket_size
The choice of resolution and bucket_size
control how large the data gathered will be, as well as how much overhead is
control how large the data gathered will be, as well as how much overhead is
encumbered for gathering the histogram.
encumbered for gathering the histogram.
Smaller values for bucket_size will garner better
Smaller values for bucket_size will garner better
results (gprof can more closely align the data with
results (gprof can more closely align the data with
actual function names) at the expense of a larger data buffer.
actual function names) at the expense of a larger data buffer.
NOTE
NOTE
The value of bucket_size will be rounded up to a power of two.
The value of bucket_size will be rounded up to a power of two.
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.