libsysactivity
0.6.5
|
Data Structures | |
struct | sa_cpu |
Functions | |
int | sa_open_cpu (void) SA_EXPORT |
int | sa_close_cpu (void) SA_EXPORT |
int | sa_reset_cpus () SA_EXPORT |
int | sa_count_cpus (uint16_t *number) SA_EXPORT SA_NONNULL |
int | sa_get_cpu (uint16_t index, struct sa_cpu *dst) SA_EXPORT SA_NONNULL |
Retrieves statistics from a given cpu index. This data is an average calculated since last time it was retrieved. If it was never calculated before it makes an average of the entire life of the cpu. sa_reset_cpus() should be called at least once before this function and everytime you need fresh values. More... | |
int | sa_get_cpus (struct sa_cpu *dst, uint16_t dst_size, uint16_t *written) SA_EXPORT SA_NONNULL |
Retrieves statistics from as many processors as possible. The data of each cpu is an average calculated since last time it was retrieved. If it was never calculated before it makes an average of the entire life of the cpu. sa_reset_cpus() should be called at least once before this function and everytime you need fresh values. More... | |
int sa_open_cpu | ( | void | ) |
Prepares the resources needed for retrieving cpu statistics. This function exists (and is needed) only when SA_OPEN_CPU is defined.
int sa_close_cpu | ( | void | ) |
This function closes the resources used for retrieving cpu statistics. You should call it even when there was a previous error in another function of this API. This function exists (and is needed) only when SA_CLOSE_CPU is defined.
int sa_reset_cpus | ( | ) |
Refreshes the underlying operating system cache.
int sa_count_cpus | ( | uint16_t * | number) |
Gives the number of processors that you can take statistics from. You don't need to call sa_reset_cpus() before this function.
number | If the underlying platform does not support per-process stats this number will be 1 (even when there are many real CPUs). See the cpu matrix for further information. |
int sa_get_cpu | ( | uint16_t | index, |
struct sa_cpu * | dst | ||
) |
Retrieves statistics from a given cpu index. This data is an average calculated since last time it was retrieved. If it was never calculated before it makes an average of the entire life of the cpu. sa_reset_cpus() should be called at least once before this function and everytime you need fresh values.
index | The cpu index. The first index value is 0. |
dst | Where the statistics will be stored. |
int sa_get_cpus | ( | struct sa_cpu * | dst, |
uint16_t | dst_size, | ||
uint16_t * | written | ||
) |
Retrieves statistics from as many processors as possible. The data of each cpu is an average calculated since last time it was retrieved. If it was never calculated before it makes an average of the entire life of the cpu. sa_reset_cpus() should be called at least once before this function and everytime you need fresh values.
dst | A buffer where the statistics will be stored. |
dst_size | The number of cpus that fits in the dst buffer. If it's not big enough dst will be filled but ENOMEM will be returned. |
written | The amount of cpu statistics written. |