Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

smonitor(3c) [hpux 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)

Check Out this Related Man Page

monitor(3)						     Library Functions Manual							monitor(3)

Name
       monitor, monstartup, moncontrol - prepare execution profile

Synopsis
       monitor(lowpc, highpc, buffer, bufsize, nfunc)
       int (*lowpc)(), (*highpc)();
       short buffer[];

       monstartup(lowpc, highpc)
       int (*lowpc)(), (*highpc)();

       moncontrol(mode)

Description
       These functions use the system call to control program-counter sampling.  Using the option -p when compiling or linking a program automati-
       cally generates calls to these functions.  You do need not to call these functions explicitly unless you want more control.

       Typically, you would call either or to initialize pc-sampling and enable it; call to disable or reenable it; and call at the end of  execu-
       tion to disable sampling and record the samples in a file.

       Your  initial  call  to	enables  pc-sampling.	The  parameters lowpc and highpc specify the range of addresses to be sampled.	The lowest
       address is that of lowpc and the highest is just below highpc.  The buffer parameter is the address of a (user allocated) array of  bufsize
       short  integers,  which	holds  a  record of the samples; for best results, the buffer should not be less than a few times smaller than the
       range of addresses sampled.  The nfunc parameter is ignored.

       The environment variable PROFDIR determines the name of the output file and whether pc-sampling takes place: if it is not set, the file	is
       named  mon.out;	if  set  to  the empty string, no pc-sampling occurs; if set to a non-empty string, the file is named string/pid.progname,
       where pid is the process id of the executing program and progname is the program's name as it appears in argv[0]. The  subdirectory  string
       must already exist.

       To profile the entire program, use the following:

	    extern eprol(), etext();
	    . . .
	    monitor(eprol, etext, buf, bufsize, 0);

       The  routine  lies just below the user program text, and lies just above it, as described in (Because the user program does not necessarily
       start at a low memory address, using a small number in place of is dangerous).

       The routine is an alternate form of that calls (see for you to allocate the buffer.

       The function selectively disables and re-enables pc-sampling within a program, allowing you to measure the cost of  particular  operations.
       The function disables pc-sampling, and reenables it.

       To stop execution monitoring and write the results in the output file, use the following:

	    monitor(0);

Files
       mon.out	     default name for output file
       libprof1.a    routines for pc-sampling

See Also
       cc(1), ld(1), profil(2), brk(2)

								       RISC								monitor(3)
Man Page