Starts and stops program address sampling for execution profiling.
Standard C Library (libc.a)
void profil (ShortBuffer, BufferSize, Offset, Scale)
void profil (ProfBuffer, -1, 0, 0)
unsigned short *ShortBuffer;
struct prof *ProfBuffer;
unsigned int Buffersize, Scale;
unsigned long Offset;
The profil subroutine arranges to record a histogram of periodically sampled values of the calling process program counter. If BufferSize is not -1:
|0177777||0xFFFF||Maps approximately each pair of bytes in the instruction space to a unique short in the ShortBuffer parameter.|
|077777||0x7FFF||Maps approximately every four bytes to a short in the ShortBuffer parameter.|
|02||0x0002||Maps all instructions to the same location, producing a noninterrupting core clock.|
|01||0x0001||Turns profiling off.|
|00||0x0000||Turns profiling off.|
If the value of the BufferSize parameter is -1:
caddr_t p_low; caddr_t p_high; HISTCOUNTER *p_buff; int p_bufsize; uint p_scale;
If the p_scale member has the value of -1, a value for it is computed based on p_low , p_high , and p_bufsize ; otherwise p_scale is interpreted like the scale argument in the first synopsis. The p_high members in successive structures must be in ascending sequence. The array of structures is ended with a structure containing a p_high member set to 0; all other fields in this last structure are ignored.
The p_buff buffer pointers in the array of prof structures must point into a single contiguous buffer space.
In every case:
|ShortBuffer||Points to an area of memory in the user address space. Its length (in bytes) is given by the BufferSize parameter.|
|BufferSize||Specifies the length (in bytes) of the buffer.|
|Offset||Specifies the delta of program counter start and buffer; for example, a 0 Offset implies that text begins at 0. If the user wants to use the entry point of a routine for the Offset parameter, the syntax of the parameter is as follows:|
|Scale||Specifies the mapping factor between the program counter and ShortBuffer.|
|ProfBuffer||Points to an array of prof structures.|
The profil subroutine always returns a value of 0. Otherwise, the errno global variable is set to indicate the error.
The profil subroutine is unsuccessful if one or both of the following are true:
|EFAULT||The address specified by the ShortBuffer or ProfBuffer parameters is not valid, or the address specified by a p_buff field is not valid. EFAULT can also occur if there are not sufficient resources to pin the profiling buffer in real storage.|
|EINVAL||The p_high fields in the prof structure specified by the ProfBuffer parameter are not in ascending order.|
This subroutine is part of Base Operating System (BOS) Runtime.
The exec subroutines, fork subroutine, moncontrol subroutine, monitor subroutine, monstartup subroutine.
The prof command.