cpu.h
/*
* libsysactivity
* http://sourceforge.net/projects/libsysactivity/
* Copyright (c) 2009-2011 Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SA_CPU_H_
#define SA_CPU_H_
struct sa_cpu {
#ifdef SA_CPU_ID
uint16_t id;
#endif
#ifdef SA_CPU_USER
float user;
#endif
#ifdef SA_CPU_NICE
float nice;
#endif
#ifdef SA_CPU_SYSTEM
float system;
#endif
#ifdef SA_CPU_IDLE
float idle;
#endif
#ifdef SA_CPU_WAITING_FOR_IO
float waiting_for_io;
#endif
#ifdef SA_CPU_HARDWARE_IRQ
float hardware_irq;
#endif
#ifdef SA_CPU_SOFTWARE_IRQ
float software_irq;
#endif
#ifdef SA_CPU_STOLEN
float stolen;
#endif
#ifdef SA_CPU_INTR
float intr;
#endif
};
#ifdef SA_OPEN_CPU
int sa_open_cpu(void) SA_EXPORT;
#endif
#ifdef SA_CLOSE_CPU
int sa_close_cpu(void) SA_EXPORT;
#endif
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;
int sa_get_cpus(struct sa_cpu* dst, uint16_t dst_size, uint16_t* written) SA_EXPORT SA_NONNULL;
#endif /* SA_CPU_H_ */
sa_open_cpu
int sa_open_cpu(void) SA_EXPORT
sa_cpu::idle
float idle
Percentage of time with no activity.
Definition: cpu.h:45
sa_get_cpu
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 wa...
sa_reset_cpus
int sa_reset_cpus() SA_EXPORT
sa_cpu::waiting_for_io
float waiting_for_io
Percentage of time spent waiting for io transferences.
Definition: cpu.h:48
sa_cpu::nice
float nice
Percentage of time spent on nice prioriced tasks.
Definition: cpu.h:39
sa_get_cpus
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 calculat...
sa_cpu::hardware_irq
float hardware_irq
Percentage of time spent working on hardware irqs.
Definition: cpu.h:51
sa_cpu::system
float system
Percentage of time spent on system tasks.
Definition: cpu.h:42
sa_cpu
Definition: cpu.h:31
sa_cpu::user
float user
Percentage of time spent on user tasks.
Definition: cpu.h:36
sa_cpu::stolen
float stolen
Percentage of time spent in other operating systems when running in a virtualized environment...
Definition: cpu.h:57
sa_close_cpu
int sa_close_cpu(void) SA_EXPORT
sa_count_cpus
int sa_count_cpus(uint16_t *number) SA_EXPORT SA_NONNULL
sa_cpu::id
uint16_t id
Cpu identificator. 0 is the first one.
Definition: cpu.h:33
sa_cpu::software_irq
float software_irq
Percentage of time spent working on software irqs.
Definition: cpu.h:54