2015-06-20 03:13:02 +05:30
|
|
|
/*
|
|
|
|
* libprocps - Library to read proc filesystem
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2016-04-25 10:30:00 +05:30
|
|
|
#ifndef PROC_STAT_H
|
|
|
|
#define PROC_STAT_H
|
2015-06-20 03:13:02 +05:30
|
|
|
|
|
|
|
#include <proc/procps.h>
|
|
|
|
|
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
|
|
enum procps_cpu_item {
|
2015-07-21 10:30:00 +05:30
|
|
|
PROCPS_CPU_USER, // jiff
|
|
|
|
PROCPS_CPU_NICE, // jiff
|
|
|
|
PROCPS_CPU_SYSTEM, // jiff
|
|
|
|
PROCPS_CPU_IDLE, // jiff
|
|
|
|
PROCPS_CPU_IOWAIT, // jiff
|
|
|
|
PROCPS_CPU_IRQ, // jiff
|
|
|
|
PROCPS_CPU_SIRQ, // jiff
|
|
|
|
PROCPS_CPU_STOLEN, // jiff
|
|
|
|
PROCPS_CPU_GUEST, // jiff
|
|
|
|
PROCPS_CPU_GNICE, // jiff
|
|
|
|
PROCPS_CPU_noop, // n/a
|
|
|
|
PROCPS_CPU_stack_end // n/a
|
2015-06-20 03:13:02 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
enum procps_stat_item {
|
2015-07-21 10:30:00 +05:30
|
|
|
PROCPS_STAT_INTR, // u_int
|
|
|
|
PROCPS_STAT_CTXT, // u_int
|
|
|
|
PROCPS_STAT_BTIME, // u_int
|
|
|
|
PROCPS_STAT_PROCS, // u_int
|
|
|
|
PROCPS_STAT_PROCS_BLK, // u_int
|
|
|
|
PROCPS_STAT_PROCS_RUN, // u_int
|
|
|
|
PROCPS_STAT_noop, // n/a
|
|
|
|
PROCPS_STAT_stack_end // n/a
|
2015-06-20 03:13:02 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
typedef unsigned long long jiff;
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-06-28 10:30:00 +05:30
|
|
|
struct procps_jiffs {
|
|
|
|
jiff user, nice, system, idle, iowait, irq, sirq, stolen, guest, gnice;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct procps_jiffs_hist {
|
|
|
|
struct procps_jiffs new;
|
|
|
|
struct procps_jiffs old;
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
2015-07-21 10:30:00 +05:30
|
|
|
struct stat_result {
|
|
|
|
int item;
|
|
|
|
union {
|
|
|
|
unsigned int u_int;
|
|
|
|
jiff jiff;
|
|
|
|
} result;
|
2015-06-28 10:30:00 +05:30
|
|
|
};
|
|
|
|
|
2015-06-30 10:30:00 +05:30
|
|
|
struct procps_stat;
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-06-30 10:30:00 +05:30
|
|
|
int procps_stat_new (struct procps_stat **info);
|
|
|
|
int procps_stat_read (struct procps_stat *info, const int cpu_only);
|
|
|
|
int procps_stat_read_jiffs (struct procps_stat *info);
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-06-30 10:30:00 +05:30
|
|
|
int procps_stat_ref (struct procps_stat *info);
|
|
|
|
int procps_stat_unref (struct procps_stat **info);
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-07-21 10:30:00 +05:30
|
|
|
jiff procps_stat_cpu_get (
|
|
|
|
struct procps_stat *info,
|
|
|
|
enum procps_cpu_item item);
|
|
|
|
|
|
|
|
int procps_stat_cpu_getstack (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct stat_result *these);
|
2015-07-21 10:30:00 +05:30
|
|
|
|
|
|
|
int procps_stat_jiffs_get (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct procps_jiffs *dest,
|
2015-07-21 10:30:00 +05:30
|
|
|
int which);
|
|
|
|
|
|
|
|
int procps_stat_jiffs_hist_get (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct procps_jiffs_hist *dest,
|
2015-07-21 10:30:00 +05:30
|
|
|
int which);
|
|
|
|
|
|
|
|
int procps_stat_jiffs_fill (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct procps_jiffs *dests,
|
|
|
|
int maxdests);
|
2015-07-21 10:30:00 +05:30
|
|
|
|
|
|
|
int procps_stat_jiffs_hist_fill (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct procps_jiffs_hist *dests,
|
|
|
|
int maxdests);
|
2015-07-21 10:30:00 +05:30
|
|
|
|
|
|
|
unsigned int procps_stat_sys_get (
|
|
|
|
struct procps_stat *info,
|
|
|
|
enum procps_stat_item item);
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-07-21 10:30:00 +05:30
|
|
|
int procps_stat_sys_getstack (
|
|
|
|
struct procps_stat *info,
|
2015-07-23 10:30:00 +05:30
|
|
|
struct stat_result *these);
|
2015-06-28 10:30:00 +05:30
|
|
|
|
2015-06-20 03:13:02 +05:30
|
|
|
__END_DECLS
|
|
|
|
#endif
|