next up previous contents index
Next: 20.3.2 moncontrol: enable or Up: 20.3 API reference Previous: 20.3 API reference

20.3.1 profil: Enable, disable, or change statistical sampling

 

SYNOPSIS

#include <oskit/c/sys/gmon.h>

#include <oskit/c/sys/profile.h>

int profil(char *samples, int size, int offset, int scale);

DESCRIPTION

This function enables or disables the statistical sampling of the program counter for the kernel. If profiling is enabled, at RTC clock tick (see below), the program counter is recorded in the samples buffer. This function is most frequently called by moncontrol().

PARAMETERS

samples
A buffer containing size bytes which is divided into a number of bins. A bin represents a range of addresses in which the PC was found when the profiling sample was taken.

size
The size in bytes of the samples array.

offset
The lowest address at which PC samples should be taken. In the oskit, this defaults to the location of the _start symbol.

scale
The scale determines the granularity of the bins. A scale of 65536 means each bin gets 2 bytes of address range. A scale of 32768 gives 4 byte, etc. A scale value of 0 disables profiling.

RETURNS

Returns 0 if all is OK, or -1 on error. Sets errno to the reason for failure.



University of Utah Flux Research Group