Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ profil(2) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

fork(2)

getsysinfo(2)

prof(1)

profil(2)  —  System Calls

NAME

profil − Starts and stops execution profiling

SYNOPSIS

void profil(
unsigned short ∗short_buffer,
unsigned int buffer_size,
void  ∗offset,
unsigned int scale );

PARAMETERS

short_bufferPoints to an area of memory in the user address space. Its length (in bytes) is given by the buffer_size parameter. 

buffer_sizeSpecifies the length (in bytes) of the buffer. 

offsetSpecifies the delta of program counter start and buffer; for example, an offset of 0 (zero) implies that text begins at 0. 

scaleSpecifies the mapping factor between the program counter and short_buffer. 

DESCRIPTION

The profil() function controls execution profiling. 

The short_buffer parameter points to an area of memory whose length (in bytes) is given by the buffer_size parameter.  After this call, the process’ program counters are examined at regular intervals (1 ms. in most implementations).  To determine the interval for your system, use the getsysinfo(2) system call with GSI_CLK_TCK as the operation parameter. The value of the offset parameter is subtracted from the program counter, and the result multiplied by the scale parameter.  The corresponding location in the short_buffer parameter is incremented if the resulting number is less than the buffer_size parameter. 

The scale parameter is interpreted as an unsigned, fixed point fraction with 16 bits of mantissa:  0x10000 gives a 1-1 mapping of program counter values to words in the short_buffer parameter; 0x8000 maps each pair of program counter values together.  The special scale factor of 2 maps all instructions onto the beginning of the short_buffer (producing a non-interrupting clock). 

Profiling is turned off by giving a scale parameter of either zero (0) or 1.  Profiling is turned off when an execve() is executed.  Profiling remains on in both the parent and child processes after a fork.  Profiling is turned off if an update in the short_buffer parameter would cause a memory fault. 

If the process contains multiple kernel threads, each will be independently sampled and the counts will reflect the sum of the samples for all of the threads. 

RELATED INFORMATION

Functions: exec(2), fork(2), getsysinfo(2)

Commands: prof(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026