#include <oskit/c/sys/gmon.h>#include <oskit/c/sys/profile.h>
int profil(char *samples, int size, int offset, int scale);
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().
- 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 0 if all is OK, or -1 on error. Sets errno to the reason for failure.