sigar/src/os/aix/sigar_os.h

107 lines
2.8 KiB
C
Raw Normal View History

2006-07-16 01:46:36 +08:00
/*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of SIGAR.
*
* SIGAR is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. This program 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 General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
2004-06-22 06:37:04 +08:00
#ifndef SIGAR_OS_H
#define SIGAR_OS_H
#include <fcntl.h>
#include <errno.h>
#include <dlfcn.h>
#include <procinfo.h>
2005-01-07 08:34:58 +08:00
#include <sys/resource.h>
#include "libperfstat.h"
2004-06-22 06:37:04 +08:00
enum {
KOFFSET_LOADAVG,
KOFFSET_VAR,
KOFFSET_SYSINFO,
KOFFSET_IFNET,
KOFFSET_VMINFO,
KOFFSET_CPUINFO,
2005-05-13 09:18:21 +08:00
KOFFSET_TCB,
2004-06-22 06:37:04 +08:00
KOFFSET_MAX
};
typedef struct {
time_t mtime;
int num;
char **devs;
} swaps_t;
typedef int (*vminfo_func_t) (void *, int, int);
typedef int (*proc_fd_func_t) (sigar_t *, sigar_pid_t, sigar_proc_fd_t *);
typedef int (*perfstat_cpu_total_func_t)(perfstat_cpu_total_t *, size_t);
2004-07-20 03:44:01 +08:00
typedef int (*perfstat_cpu_func_t)(perfstat_id_t *,
2004-07-20 03:44:01 +08:00
perfstat_cpu_t *,
size_t, int);
typedef int (*perfstat_swap_func_t)(perfstat_id_t *,
perfstat_pagingspace_t *,
size_t, int);
typedef int (*perfstat_disk_func_t)(perfstat_id_t *,
perfstat_disk_t *,
size_t, int);
typedef int (*perfstat_ifstat_func_t)(perfstat_id_t *,
perfstat_netinterface_t *);
2005-01-07 08:34:58 +08:00
typedef int (*thread_rusage_func_t)(struct rusage *, int);
2004-06-22 06:37:04 +08:00
struct sigar_t {
SIGAR_T_BASE;
int kmem;
2005-02-24 01:29:10 +08:00
int dmem;
2004-06-22 06:37:04 +08:00
/* offsets for seeking on kmem */
long koffsets[KOFFSET_MAX];
vminfo_func_t getvminfo;
proc_fd_func_t getprocfd;
struct {
int avail;
2004-07-20 03:44:01 +08:00
perfstat_cpu_func_t cpu;
perfstat_cpu_total_func_t cpu_total;
perfstat_swap_func_t swap;
perfstat_disk_func_t disk;
perfstat_ifstat_func_t ifstat;
2005-01-07 08:34:58 +08:00
thread_rusage_func_t thread_rusage;
void *handle;
} perfstat;
2004-06-22 06:37:04 +08:00
int pagesize;
swaps_t swaps;
time_t last_getprocs;
sigar_pid_t last_pid;
struct procsinfo64 *pinfo;
2004-06-22 06:37:04 +08:00
struct cpuinfo *cpuinfo;
int cpuinfo_size;
int cpu_mhz;
2004-07-03 07:02:04 +08:00
char model[128];
int aix_version;
2005-01-07 08:34:58 +08:00
int thrusage;
2004-12-06 11:51:15 +08:00
sigar_cache_t *diskmap;
2004-06-22 06:37:04 +08:00
};
#define HAVE_STRERROR_R
#define SIGAR_EPERM_KMEM (SIGAR_OS_START_ERROR+1)
#endif /* SIGAR_OS_H */