To use dylibprof(1), /usr/etc/profileServer must be running. Currently /usr/etc/profileServer must be executed from a console login as root due to bootstrap port issues. So first start /usr/etc/profileServer and leave it running in the back ground:
# /usr/etc/profileServer >& /dev/console &
/usr/etc/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.
USING /etc/bootstrap.conf IS CURRENTLY BROKEN. If you need to profile from boot up for all processes then the following line can be added to /etc/bootstrap.conf:
server "/usr/etc/profileServer /lib/libsys_s.A.dylib" services NSProfileServer; 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
% dylibprof -c /lib/libsys_s.A.dylib
Then begin the sampling:
% dylibprof -b /lib/libsys_s.A.dylibAfter this programs launched using this library will be part of the shared pc sampling. Typlically what would be done is to then use the system normally for a number of hours.
Then to halt the sampling:
% dylibprof -h /lib/libsys_s.A.dylib
The profiling output file (a gmon.out file) can be created with:
% dylibprof -p -o /tmp/gmon.out /lib/libsys_s.A.dylib
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 /lib/libsys_s.A.dylib gmon.out When no more sampling for this library is to be done the sample buffer can be removed with: % dylibprof -r /lib/libsys_s.A.dylib
The options are: