libsysactivity
0.6.4
|
Data Structures | |
struct | sa_process_activity |
struct | sa_process |
Enumerations | |
enum | sa_process_state { SA_UNKNOWN = 0, SA_RUNNING = 1, SA_SLEEPING = 2, SA_SLEEPING_UNINTERRUPTIBLE = 3, SA_ZOMBIE = 4, SA_STOPPED = 5 } |
Functions | |
int | sa_open_process () SA_EXPORT |
int | sa_close_process () SA_EXPORT |
int | sa_count_processes (uint32_t *number) SA_EXPORT SA_NONNULL |
int | sa_get_processes_ids (pid_t *dst, uint32_t dst_size, uint32_t *written) SA_EXPORT SA_NONNULL |
int | sa_get_process (pid_t pid, struct sa_process *dst) SA_EXPORT SA_NONNULL |
int | sa_get_process_activity (pid_t pid, struct sa_process_activity *dst) SA_EXPORT SA_NONNULL |
enum sa_process_state |
The different types of states of a process.
int sa_open_process | ( | ) |
Prepares the resources needed for retrieving process statistics. This function exists (and is needed) only when SA_OPEN_PROCESS is defined.
int sa_close_process | ( | ) |
This function closes the resources used for retrieving process 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_PROCESS is defined.
int sa_count_processes | ( | uint32_t * | number | ) |
Gives the total number of processes on the systems.
number | The number will be stored here |
int sa_get_processes_ids | ( | pid_t * | dst, |
uint32_t | dst_size, | ||
uint32_t * | written | ||
) |
Gets a list of the existing processes ids. The array will be fully populated even if it's not big enough (but ENOMEM is returned).
dst | A pointer to the array to populate. |
dst_size | The number of pid_t that fits in the array. |
written | The number of pids written is stored here. |
int sa_get_process | ( | pid_t | pid, |
struct sa_process * | dst | ||
) |
Retrieves statistics from a process identified by its pid.
pid | The pid of the process. |
dst | Where the statistics will be stored. |
int sa_get_process_activity | ( | pid_t | pid, |
struct sa_process_activity * | dst | ||
) |
Retrieves the activity of a process on the dst parameter.
pid | The pid of the process. |
dst | Where the statistics will be stored. |