Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

fork(2)

prof(1)

gprof(1)

profil(2)  —  System Calls

OSF

NAME

profil − Starts and stops execution profiling

SYNOPSIS

void profil(
short ∗short_buffer,
unsigned int buffer_size,
unsigned int 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 (10 ms. in most implementations).  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. 

Profiling is turned off by giving a scale parameter of 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)

Commands: prof(1), gprof(1)

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