DYLIBPROF(1) General Commands Manual DYLIBPROF(1)NAME
dylibprof - control the shared pc sampling of a dynamic shared library
SYNOPSIS
dylibprof [-e | -d] | [-c | -r | -b | -h | -p [-o <file>] <dylib>]
DESCRIPTION
Dylibprof along with the server /usr/libexec/profileServer allows shared program counter sampling of a dynamic shared library across all
the programs that use the library.
To use dylibprof(1), /usr/libexec/profileServer must be running. So first start /usr/libexec/profileServer and leave it running in the
back ground:
% /usr/libexec/profileServer >& /dev/console &
/usr/libexec/profileServer starts up with shared pc sampling disabled. It should not be left running with shared pc sampling enabled if no
sampling is being done as every launch of a program that uses the dynamic linker is effected. This is true even to a small extent if there
no libraries being sampled.
If you need to profile from boot up for all processes then the following line can be added to /etc/bootstrap.conf:
server "/usr/libexec/profileServer" services NSProfileServer NSProfileControl;
Before any dynamic shared library can be sampled sampling must be enabled as
follows:
% dylibprof -e
It can then later be disabled when no more sampling is to be done with:
% dylibprof -d
EXAMPLE
To sample the dynamic shared library /System/Library/Frameworks/System.framework/Versions/B/System for example requires the following
steps. First create a sample buffer for the library:
% dylibprof -c /System/Library/Frameworks/System.framework/Versions/B/System
Then begin the sampling:
% dylibprof -b /System/Library/Frameworks/System.framework/Versions/B/System
After this programs launched using this library will be part of the shared pc sampling. Typically what would be done is to then use the
system normally for a number of hours.
Then to halt the sampling:
% dylibprof -h /System/Library/Frameworks/System.framework/Versions/B/System
The profiling output file (a gmon.out file) can be created with:
% dylibprof -p -o /tmp/gmon.out /System/Library/Frameworks/System.framework/Versions/B/System
Using the profiling output file and the library a profile listing and a time based order file (time.order) can be created with: gprof(1):
% gprof -S /System/Library/Frameworks/System.framework/Versions/B/System /tmp/gmon.out
When no more sampling for this library is to be done the sample buffer can be
removed with:
% dylibprof -r /System/Library/Frameworks/System.framework/Versions/B/System
The options are:
-e Enable shared program counter sampling for dynamic libraries.
-d Disable shared program counter sampling for dynamic libraries.
-c Create a pc sample buffer for the library.
-b Begin sampling for programs subsequently launched using the library.
-h Halt sampling for programs subsequently launched using the library.
-p Produce a profiling output file (a gmon.out file) for the library.
-r Remove the pc sample buffer for the library.
-o name
Use the file name instead of gmon.out when producing the profiling output file with the -p above.
FILES
gmon.out profile output file
/var/tmp/profile/profile.XXXXXX the sample buffer file
SEE ALSO gprof(1)Apple Computer, Inc. March 19, 2002 DYLIBPROF(1)
Check Out this Related Man Page
smonitor(3C)smonitor(3C)NAME
smonitor() - prepare execution profile
SYNOPSIS DESCRIPTION
is an interface to sprofil(2) for collecting sampling information for execution profiles.
To use link in the library by specifying on the linker command line or on the compiler command line. See gprof(1).
For any application compiled with the option, the library collects profiling sampling information. But if an application requires finer
control over profiling, the library yields control to an application that uses
To stop the collection of sampling information, use:
Use gprof(1) to examine the results.
Parameters
is an array of structures describing the regions to be profiled. It is defined in header The structure has the following fields:
The fields are as follows:
is the start address of the text segment of the load module.
is the end address of the text segment of the load module.
is the name of the load module (not the path name). The name of the load module should be the same as recorded in the executable by
is the number of elements in the array regions.
is the starting address a buffer to collect sampling information.
is the length of is the only memory region used by to collect profiling information, so it should be big enough for all specified regions.
does not initialize With more than one call to in the same process, dumps the sampling information collected with the last call. does not
discard the information collected in previous calls if it is present in the buffer passed to last call of
is unused and kept for future usage.
is used to choose 16-bit or 32-bit buckets to collect sampling information. If is set to treats the buffer as an array of 16-bit buckets;
if set to treats the buffer as an array of 32-bit buckets. For more information refer to sprofil(2).
EXTERNAL INFLUENCES
Environment Variables
The behavior of is controlled by the environment variable. See gprof(1). behaves with different settings of as follows:
does not set up the buffers to collect sampling information.
It is expected that will be called explicitly to collect the sampling information. So it is the ideal case to call the explicitly.
sets up the sampling buffer for all the load modules and starts
to collect the sampling information. Now if is invoked explicitly, is stopped, the buffer allocated by is deallocated, and all the
sampling information collected prior to calling is lost. uses the buffer passed as an argument and starts again.
sets up the sampling buffer for the load modules
ldm1 and ldm2 and starts to collect the sampling information. Now if is invoked explicitly, is stopped, the buffer allocated by is
deallocated, and all the sampling information collected prior to calling is lost. uses the buffer passed as an argument and starts
again.
If is not set, behaves as though
FILES SEE ALSO cc(1), gprof(1), sprofil(2).
smonitor(3C)