United States-English |
|
|
HP-UX Reference > Ssmonitor(3C)HP-UX 11i Version 3: February 2007 |
|
NAMEsmonitor() — prepare execution profile SYNOPSIS#include <mon.h> #include <sys/profil.h> void smonitor( struct text_region *regions, int nregions, void *buffer, size_t bufsize, int nfunc, unsigned flags ); DESCRIPTIONsmonitor() is an interface to sprofil(2) for collecting sampling information for execution profiles. To use smonitor(), link in the gprof library by specifying -lgprof on the linker command line or -G on the compiler command line. See gprof(1). For any application compiled with the -G option, the gprof library collects profiling sampling information. But if an application requires finer control over profiling, the gprof library yields control to an application that uses smonitor(). To stop the collection of sampling information, use: smonitor(0, 0, 0, 0, 0, 0); Use gprof(1) to examine the results. Parametersregions is an array of text_region structures describing the regions to be profiled. It is defined in header <mon.h>. The text_region structure has the following fields: unsigned long text_start; unsigned long text_end; char *name; The fields are as follows:
nregions is the number of elements in the array regions. buffer is the starting address a buffer to collect sampling information. bufsize is the length of buffer. buffer is the only memory region used by smonitor() to collect profiling information, so it should be big enough for all specified regions. smonitor() does not initialize buffer. With more than one call to smonitor() in the same process, smonitor() dumps the sampling information collected with the last call. smonitor() does not discard the information collected in previous calls if it is present in the buffer passed to last call of smonitor(). nfunc is unused and kept for future usage. flags is used to choose 16-bit or 32-bit buckets to collect sampling information. If flags is set to PROF_USHORT, smonitor() treats the buffer as an array of 16-bit buckets; if set to PROF_UINT, smonitor() treats the buffer as an array of 32-bit buckets. For more information refer to sprofil(2). EXTERNAL INFLUENCESEnvironment VariablesThe behavior of smonitor() is controlled by the LD_PROFILE environment variable. See gprof(1). smonitor() behaves with different settings of LD_PROFILE as follows:
If LD_PROFILE is not set, smonitor() behaves as though LD_PROFILE=ALL. |
Printable version | ||
|