diff --git a/bindings/java/build.xml b/bindings/java/build.xml
index cc4b1546..c173ce18 100644
--- a/bindings/java/build.xml
+++ b/bindings/java/build.xml
@@ -287,7 +287,7 @@
-
+
@@ -354,15 +354,6 @@
depends="jni-init,prepare-src,jni-compile,jni-lib-copy,copy-includes"
if="jni.libarch"/>
-
-
-
-
-
-
-
-
-
@@ -374,7 +365,7 @@
-
+
diff --git a/src/os/aix/aix_sigar.c b/src/os/aix/aix_sigar.c
index 4679617a..ae89fa58 100644
--- a/src/os/aix/aix_sigar.c
+++ b/src/os/aix/aix_sigar.c
@@ -33,6 +33,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -134,6 +136,21 @@ static int kread(sigar_t *sigar, void *data, int size, long offset)
return SIGAR_OK;
}
+static int sigar_thread_rusage(struct rusage *usage, int mode)
+{
+ return pthread_getrusage_np(pthread_self(), usage, mode);
+}
+
+static int sigar_perfstat_memory(perfstat_memory_total_t *memory)
+{
+ return perfstat_memory_total(NULL, memory, sizeof(*memory), 1);
+}
+
+static int sigar_perfstat_cpu(perfstat_cpu_total_t *cpu_total)
+{
+ return perfstat_cpu_total(NULL, cpu_total, sizeof(*cpu_total), 1);
+}
+
int sigar_os_open(sigar_t **sigar)
{
int status, i;
@@ -146,7 +163,6 @@ int sigar_os_open(sigar_t **sigar)
(*sigar)->getprocfd = NULL; /*XXX*/
(*sigar)->kmem = kmem;
- (*sigar)->dmem = -1;
(*sigar)->pagesize = 0;
(*sigar)->ticks = sysconf(_SC_CLK_TCK);
(*sigar)->boot_time = 0;
@@ -155,7 +171,6 @@ int sigar_os_open(sigar_t **sigar)
(*sigar)->cpuinfo = NULL;
(*sigar)->cpuinfo_size = 0;
SIGAR_ZERO(&(*sigar)->swaps);
- SIGAR_ZERO(&(*sigar)->perfstat);
i = getpagesize();
while ((i >>= 1) > 0) {
@@ -193,25 +208,19 @@ int sigar_os_close(sigar_t *sigar)
if (sigar->kmem > 0) {
close(sigar->kmem);
}
- if (sigar->dmem > 0) {
- close(sigar->dmem);
- }
if (sigar->pinfo) {
free(sigar->pinfo);
}
if (sigar->cpuinfo) {
free(sigar->cpuinfo);
}
- if (sigar->perfstat.handle) {
- dlclose(sigar->perfstat.handle);
- }
if (sigar->diskmap) {
sigar_cache_destroy(sigar->diskmap);
}
if (sigar->thrusage == PTHRDSINFO_RUSAGE_START) {
struct rusage usage;
- sigar->perfstat.thread_rusage(&usage,
- PTHRDSINFO_RUSAGE_STOP);
+ sigar_thread_rusage(&usage,
+ PTHRDSINFO_RUSAGE_STOP);
}
free(sigar);
return SIGAR_OK;
@@ -227,263 +236,21 @@ char *sigar_os_error_string(sigar_t *sigar, int err)
}
}
-static int proc_module_get_self(void *data, char *name, int len)
-{
- sigar_t *sigar = (sigar_t *)data;
- char *ptr = rindex(name, '/');
-
- if (!ptr) {
- return SIGAR_OK;
- }
-
- if (strnEQ(ptr+1, "libsigar-", 9)) {
- *ptr = '\0'; /* chop libsigar-powerpc-ibm-aix-4.3.x.so */
-
- sigar->self_path = sigar_strdup(name);
-
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "detected sigar-lib='%s'",
- sigar->self_path);
- }
-
- return !SIGAR_OK; /* break loop */
- }
-
- return SIGAR_OK;
-}
-
-static char *sigar_get_self_path(sigar_t *sigar)
-{
- if (!sigar->self_path) {
- sigar_proc_modules_t procmods;
- procmods.module_getter = proc_module_get_self;
- procmods.data = sigar;
-
- sigar_proc_modules_get(sigar, sigar_pid_get(sigar),
- &procmods);
-
- if (!sigar->self_path) {
- /* dont try again */
- sigar->self_path = sigar_strdup(".");
- }
- }
-
- return sigar->self_path;
-}
-
-/*
- * the perfstat api is only supported in aix 5.2+
- * in order to be binary compatible with 4.3 and 5.1
- * we must jump through some hoops. libperfstat.a
- * is a static library, we need dynamic.
- * libsigar_aixperfstat.so is juat a proxy to libperfstat.a
- */
-#define SIGAR_AIXPERFSTAT "/libsigar_aixperfstat.so"
-
-static int sigar_perfstat_init(sigar_t *sigar)
-{
- void *handle;
- char libperfstat[SIGAR_PATH_MAX+1], *path;
- int len;
-
- if (sigar->perfstat.avail == 1) {
- return SIGAR_OK;
- }
- if (sigar->perfstat.avail == -1) {
- return ENOENT;
- }
-
- path = sigar_get_self_path(sigar);
- len = strlen(path);
-
- memcpy(&libperfstat[0], path, len);
- memcpy(&libperfstat[len], SIGAR_AIXPERFSTAT,
- sizeof(SIGAR_AIXPERFSTAT));
-
- if (!(handle = dlopen(libperfstat, RTLD_LOCAL|RTLD_LAZY))) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "failed to open '%s': %s",
- libperfstat, sigar_strerror(sigar, errno));
- }
-
- sigar->perfstat.avail = -1;
- return errno;
- }
-
- sigar->perfstat.thread_rusage =
- (thread_rusage_func_t)dlsym(handle,
- "sigar_thread_rusage");
-
- if (!sigar->perfstat.thread_rusage) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_thread_rusage) failed: %s",
- dlerror());
- }
- }
-
- sigar->perfstat.cpu_total =
- (perfstat_cpu_total_func_t)dlsym(handle,
- "sigar_perfstat_cpu_total");
-
- if (!sigar->perfstat.cpu_total) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_cpu_total) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.cpu =
- (perfstat_cpu_func_t)dlsym(handle,
- "sigar_perfstat_cpu");
-
- if (!sigar->perfstat.cpu) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_cpu) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.swap =
- (perfstat_swap_func_t)dlsym(handle,
- "sigar_perfstat_pagingspace");
-
- if (!sigar->perfstat.swap) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_pagingspace) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.mem =
- (perfstat_mem_func_t)dlsym(handle,
- "sigar_perfstat_memory");
-
- if (!sigar->perfstat.mem) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_memory) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.disk =
- (perfstat_disk_func_t)dlsym(handle,
- "sigar_perfstat_disk");
-
- if (!sigar->perfstat.disk) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_disk) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.ifstat =
- (perfstat_ifstat_func_t)dlsym(handle,
- "sigar_perfstat_netinterface");
-
- if (!sigar->perfstat.ifstat) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_netinterface) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.protocol =
- (perfstat_protocol_func_t)dlsym(handle,
- "sigar_perfstat_protocol");
-
- if (!sigar->perfstat.protocol) {
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "dlsym(sigar_perfstat_protocol) failed: %s",
- dlerror());
- }
-
- dlclose(handle);
-
- sigar->perfstat.avail = -1;
- return ENOENT;
- }
-
- sigar->perfstat.avail = 1;
- sigar->perfstat.handle = handle;
-
- return SIGAR_OK;
-}
-
#define PAGESHIFT(v) \
((v) << sigar->pagesize)
int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
{
int status;
+ perfstat_memory_total_t minfo;
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- perfstat_memory_total_t minfo;
-
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[mem] using libperfstat");
-
- if (sigar->perfstat.mem(&minfo) == 1) {
- mem->total = PAGESHIFT(minfo.real_total);
- mem->free = PAGESHIFT(minfo.real_free);
- }
- else {
- return errno;
- }
+ if (sigar_perfstat_memory(&minfo) == 1) {
+ mem->total = PAGESHIFT(minfo.real_total);
+ mem->free = PAGESHIFT(minfo.real_free);
}
else {
- struct vminfo vm;
-
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[mem] using /dev/kmem");
-
- status = kread(sigar, &vm, sizeof(vm),
- sigar->koffsets[KOFFSET_VMINFO]);
-
- if (status != SIGAR_OK) {
- return status;
- }
-
- mem->total = PAGESHIFT(vm.memsizepgs); /* lsattr -El sys0 -a realmem */
- mem->free = PAGESHIFT(vm.numfrb);
- }
+ return errno;
+ }
mem->used = mem->total - mem->free;
mem->actual_used = mem->used;
@@ -638,12 +405,12 @@ static int sigar_swap_get_swapqry(sigar_t *sigar, sigar_swap_t *swap)
#define SWAP_DEV(ps) \
((ps.type == LV_PAGING) ? \
- ps.id.lv_paging.vgname : \
- ps.id.nfs_paging.filename)
+ ps.u.lv_paging.vgname : \
+ ps.u.nfs_paging.filename)
#define SWAP_MB_TO_BYTES(v) ((v) * (1024 * 1024))
-static int sigar_swap_get_perfstat(sigar_t *sigar, sigar_swap_t *swap)
+int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
{
perfstat_memory_total_t minfo;
perfstat_pagingspace_t ps;
@@ -654,7 +421,7 @@ static int sigar_swap_get_perfstat(sigar_t *sigar, sigar_swap_t *swap)
SIGAR_ZERO(swap);
do {
- if (sigar->perfstat.swap(&id, &ps, 1) != 1) {
+ if (perfstat_pagingspace(&id, &ps, sizeof(ps), 1) != 1) {
if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[swap] dev=%s query failed: %s",
@@ -681,26 +448,14 @@ static int sigar_swap_get_perfstat(sigar_t *sigar, sigar_swap_t *swap)
swap->free = swap->total - swap->used;
- if (sigar->perfstat.mem(&minfo) == 1) {
+ if (sigar_perfstat_memory(&minfo) == 1) {
swap->page_in = minfo.pgins;
swap->page_out = minfo.pgouts;
}
-
- return SIGAR_OK;
-}
-
-int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap)
-{
- swap->page_in = swap->page_out = -1;
-
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[swap] using libperfstat");
- return sigar_swap_get_perfstat(sigar, swap);
- }
else {
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[swap] using /dev/kmem");
- return sigar_swap_get_swapqry(sigar, swap);
+ swap->page_in = swap->page_out = -1;
}
+ return SIGAR_OK;
}
int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
@@ -709,43 +464,21 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
struct sysinfo data;
perfstat_cpu_total_t cpu_data;
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[cpu] using libperfstat");
-
- if (sigar->perfstat.cpu_total(&cpu_data) == 1) {
- cpu->user = SIGAR_TICK2MSEC(cpu_data.user);
- cpu->nice = SIGAR_FIELD_NOTIMPL; /* N/A */
- cpu->sys = SIGAR_TICK2MSEC(cpu_data.sys);
- cpu->idle = SIGAR_TICK2MSEC(cpu_data.idle);
- cpu->wait = SIGAR_TICK2MSEC(cpu_data.wait);
- cpu->irq = 0; /*N/A*/
- cpu->soft_irq = 0; /*N/A*/
- cpu->stolen = 0; /*N/A*/
- cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
- return SIGAR_OK;
- }
+ if (sigar_perfstat_cpu(&cpu_data) == 1) {
+ cpu->user = SIGAR_TICK2MSEC(cpu_data.user);
+ cpu->nice = SIGAR_FIELD_NOTIMPL; /* N/A */
+ cpu->sys = SIGAR_TICK2MSEC(cpu_data.sys);
+ cpu->idle = SIGAR_TICK2MSEC(cpu_data.idle);
+ cpu->wait = SIGAR_TICK2MSEC(cpu_data.wait);
+ cpu->irq = 0; /*N/A*/
+ cpu->soft_irq = 0; /*N/A*/
+ cpu->stolen = 0; /*N/A*/
+ cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
+ return SIGAR_OK;
}
-
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[cpu] using /dev/kmem");
-
- status = kread(sigar, &data, sizeof(data),
- sigar->koffsets[KOFFSET_SYSINFO]);
-
- if (status != SIGAR_OK) {
- return status;
+ else {
+ return errno;
}
-
- cpu->user = SIGAR_TICK2MSEC(data.cpu[CPU_USER]);
- cpu->nice = SIGAR_FIELD_NOTIMPL; /* N/A */
- cpu->sys = SIGAR_TICK2MSEC(data.cpu[CPU_KERNEL]);
- cpu->idle = SIGAR_TICK2MSEC(data.cpu[CPU_IDLE]);
- cpu->wait = SIGAR_TICK2MSEC(data.cpu[CPU_WAIT]);
- cpu->irq = 0; /*N/A*/
- cpu->soft_irq = 0; /*N/A*/
- cpu->stolen = 0; /*N/A*/
- cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
-
- return SIGAR_OK;
}
/*
@@ -774,49 +507,7 @@ int sigar_cpu_get(sigar_t *sigar, sigar_cpu_t *cpu)
* };
*/
-static int sigar_cpu_list_get_kmem(sigar_t *sigar, sigar_cpu_list_t *cpulist)
-{
- int status, i, j;
- int ncpu = _system_configuration.ncpus; /* this can change */
- int size = ncpu * sizeof(struct cpuinfo);
-
- if (sigar->cpuinfo_size < size) {
- sigar->cpuinfo = realloc(sigar->cpuinfo, size);
- }
-
- status = kread(sigar, sigar->cpuinfo, size,
- sigar->koffsets[KOFFSET_CPUINFO]);
-
- if (status != SIGAR_OK) {
- return status;
- }
-
- sigar_cpu_list_create(cpulist);
-
- for (i=0; idata[cpulist->number++];
-
- info = &sigar->cpuinfo[i];
- cpu->user = SIGAR_TICK2MSEC(info->cpu[CPU_USER]);
- cpu->nice = 0; /* N/A */
- cpu->sys = SIGAR_TICK2MSEC(info->cpu[CPU_KERNEL]);
- cpu->idle = SIGAR_TICK2MSEC(info->cpu[CPU_IDLE]);
- cpu->wait = SIGAR_TICK2MSEC(info->cpu[CPU_WAIT]);
- cpu->irq = 0; /*N/A*/
- cpu->soft_irq = 0; /*N/A*/
- cpu->stolen = 0; /*N/A*/
- cpu->total = cpu->user + cpu->sys + cpu->idle + cpu->wait;
- }
-
- return SIGAR_OK;
-}
-
-static int sigar_cpu_list_get_pstat(sigar_t *sigar, sigar_cpu_list_t *cpulist)
+int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
{
perfstat_cpu_t data;
int i, ncpu = _system_configuration.ncpus; /* this can change */
@@ -839,7 +530,7 @@ static int sigar_cpu_list_get_pstat(sigar_t *sigar, sigar_cpu_list_t *cpulist)
i, id.name);
}
- if (sigar->perfstat.cpu(&id, &data, 1) == 1) {
+ if (perfstat_cpu(&id, &data, sizeof(data), 1) == 1) {
cpu->user = SIGAR_TICK2MSEC(data.user);
cpu->nice = SIGAR_FIELD_NOTIMPL; /* N/A */
cpu->sys = SIGAR_TICK2MSEC(data.sys);
@@ -861,18 +552,6 @@ static int sigar_cpu_list_get_pstat(sigar_t *sigar, sigar_cpu_list_t *cpulist)
return SIGAR_OK;
}
-int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist)
-{
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[cpu_list] using libperfstat");
- return sigar_cpu_list_get_pstat(sigar, cpulist);
- }
- else {
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[cpu_list] using /dev/kmem");
- return sigar_cpu_list_get_kmem(sigar, cpulist);
- }
-}
-
static int boot_time(sigar_t *sigar, time_t *time)
{
int fd;
@@ -980,38 +659,15 @@ int sigar_loadavg_get(sigar_t *sigar,
int data[3];
perfstat_cpu_total_t cpu_data;
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- sigar_log(sigar, SIGAR_LOG_DEBUG,
- "[loadavg] using libperfstat");
-
- if (sigar->perfstat.cpu_total(&cpu_data) == 1) {
- for (i=0; i<3; i++) {
- loadavg->loadavg[i] = FIXED_TO_DOUBLE(cpu_data.loadavg[i]);
- }
- return SIGAR_OK;
- }
- else {
- sigar_log_printf(sigar, SIGAR_LOG_ERROR,
- "perfstat_cpu_total failed: %s",
- sigar_strerror(sigar, errno));
+ if (sigar_perfstat_cpu(&cpu_data) == 1) {
+ for (i=0; i<3; i++) {
+ loadavg->loadavg[i] = FIXED_TO_DOUBLE(cpu_data.loadavg[i]);
}
+ return SIGAR_OK;
}
-
- sigar_log(sigar, SIGAR_LOG_DEBUG,
- "[loadavg] using /dev/kmem");
-
- status = kread(sigar, &data, sizeof(data),
- sigar->koffsets[KOFFSET_LOADAVG]);
-
- if (status != SIGAR_OK) {
- return status;
+ else {
+ return errno;
}
-
- for (i=0; i<3; i++) {
- loadavg->loadavg[i] = FIXED_TO_DOUBLE(data[i]);
- }
-
- return SIGAR_OK;
}
int sigar_os_proc_list_get(sigar_t *sigar,
@@ -1359,24 +1015,19 @@ int sigar_thread_cpu_get(sigar_t *sigar,
struct rusage usage;
int retval;
- sigar_perfstat_init(sigar);
- if (!sigar->perfstat.thread_rusage) {
- return SIGAR_ENOTIMPL;
- }
-
if (sigar->thrusage != PTHRDSINFO_RUSAGE_START) {
sigar->thrusage = PTHRDSINFO_RUSAGE_START;
retval =
- sigar->perfstat.thread_rusage(&usage,
- PTHRDSINFO_RUSAGE_START);
+ sigar_thread_rusage(&usage,
+ PTHRDSINFO_RUSAGE_START);
if (retval != 0) {
return retval;
}
}
retval =
- sigar->perfstat.thread_rusage(&usage,
- PTHRDSINFO_RUSAGE_COLLECT);
+ sigar_thread_rusage(&usage,
+ PTHRDSINFO_RUSAGE_COLLECT);
if (retval != 0) {
return retval;
}
@@ -1514,88 +1165,18 @@ int sigar_file_system_list_get(sigar_t *sigar,
return SIGAR_OK;
}
-#define LSPV_CMD "/usr/sbin/lspv"
-
typedef struct {
char name[IDENTIFIER_LENGTH];
long addr;
} aix_diskio_t;
-/*
- * dont have per-partition metrics on aix.
- * need to build a mount point => diskname map.
- * see 'lspv -l hdisk0' for example.
- */
-static int create_diskmap_v4(sigar_t *sigar)
-{
- FILE *fp = popen(LSPV_CMD, "r");
- char buffer[BUFSIZ], *ptr;
-
- sigar->diskmap = sigar_cache_new(25);
-
- if (!fp) {
- return ENOENT;
- }
-
- while ((ptr = fgets(buffer, sizeof(buffer), fp))) {
- FILE *lfp;
- char cmd[256], disk[IDENTIFIER_LENGTH];
- char *s;
-
- if (strstr(ptr, " None")) {
- continue; /* no volume group */
- }
- if ((s = strchr(ptr, ' '))) {
- *s = '\0';
- }
- SIGAR_SSTRCPY(disk, ptr);
- snprintf(cmd, sizeof(cmd),
- LSPV_CMD " -l %s", disk);
- if (!(lfp = popen(cmd, "r"))) {
- continue;
- }
-
- (void)fgets(buffer, sizeof(buffer), lfp); /* skip disk: */
- (void)fgets(buffer, sizeof(buffer), lfp); /* skip headers */
- while ((ptr = fgets(buffer, sizeof(buffer), lfp))) {
- sigar_cache_entry_t *ent;
- struct stat sb;
- int retval;
- /* LV NAME LPs PPs DISTRIBUTION */
- ptr = sigar_skip_multiple_token(ptr, 4);
- SIGAR_SKIP_SPACE(ptr);
- if ((s = strchr(ptr, '\n'))) {
- *s = '\0';
- }
- if (strEQ(ptr, "N/A")) {
- continue;
- }
- retval = stat(ptr, &sb);
- if (retval == 0) {
- aix_diskio_t *diskio = malloc(sizeof(*diskio));
- SIGAR_SSTRCPY(diskio->name, disk);
- diskio->addr = -1;
- ent = sigar_cache_get(sigar->diskmap, SIGAR_FSDEV_ID(sb));
- ent->value = diskio;
- }
- }
- pclose(lfp);
- }
- pclose(fp);
-}
-
-static int create_diskmap_v5(sigar_t *sigar)
+static int create_diskmap(sigar_t *sigar)
{
int i, total, num;
perfstat_disk_t *disk;
perfstat_id_t id;
- sigar_perfstat_init(sigar);
- if (!sigar->perfstat.disk) {
- return SIGAR_ENOTIMPL;
- }
-
- total = sigar->perfstat.disk(NULL, NULL, 0);
+ total = perfstat_disk(NULL, NULL, sizeof(*disk), 0);
if (total < 1) {
return ENOENT;
}
@@ -1603,7 +1184,7 @@ static int create_diskmap_v5(sigar_t *sigar)
disk = malloc(total * sizeof(*disk));
id.name[0] = '\0';
- num = sigar->perfstat.disk(&id, disk, total);
+ num = perfstat_disk(&id, disk, sizeof(*disk), total);
if (num < 1) {
free(disk);
return ENOENT;
@@ -1657,115 +1238,15 @@ static int create_diskmap_v5(sigar_t *sigar)
return SIGAR_OK;
}
-static int create_diskmap(sigar_t *sigar)
-{
- if (create_diskmap_v5(sigar) != SIGAR_OK) {
- return create_diskmap_v4(sigar);
- }
- return SIGAR_OK;
-}
-
-static void set_disk_metrics(struct dkstat *dkstat,
- sigar_file_system_usage_t *fsusage)
-{
- fsusage->disk.reads = dkstat->dk_rblks;
- fsusage->disk.writes = dkstat->dk_wblks;
- fsusage->disk.read_bytes = dkstat->dk_rblks * dkstat->dk_bsize;
- fsusage->disk.write_bytes = dkstat->dk_wblks * dkstat->dk_bsize;
- fsusage->disk.time = dkstat->dk_time;
- fsusage->disk.rtime = SIGAR_FIELD_NOTIMPL;
- fsusage->disk.wtime = SIGAR_FIELD_NOTIMPL;
- if (dkstat->dk_qd_magic == dk_q_depth_magic) {
- fsusage->disk.queue = dkstat->dk_q_depth;
- }
- else {
- fsusage->disk.queue = SIGAR_FIELD_NOTIMPL;
- }
-}
-
-static int get_disk_metrics(sigar_t *sigar,
- sigar_file_system_usage_t *fsusage,
- aix_diskio_t *diskio)
-{
- int i, cnt, fd, status;
- struct iostat iostat;
- struct dkstat dkstat, *dp;
- struct nlist nl[] = {
- { "iostat" },
- };
-
- status = sigar_disk_usage_get(sigar, diskio->name, &fsusage->disk);
- if (status == SIGAR_OK) {
- return SIGAR_OK;
- }
-
- if (sigar->dmem == -1) {
- if ((sigar->dmem = open("/dev/mem", O_RDONLY)) <= 0) {
- return errno;
- }
- }
-
- fd = sigar->dmem;
-
- if (diskio->addr != -1) {
- int status;
- lseek(fd, diskio->addr, SEEK_SET);
- read(fd, &dkstat, sizeof(dkstat));
-
- if (strEQ(diskio->name, dkstat.diskname)) {
- set_disk_metrics(&dkstat, fsusage);
- status = SIGAR_OK;
- }
- else {
- status = ENOENT;
- }
- return status;
- }
-
- i = knlist(nl, 1, sizeof(struct nlist));
-
- if (i == -1) {
- return errno;
- }
-
- if (nl[i].n_value == 0) {
- return ENOENT;
- }
-
- lseek(fd, nl[0].n_value, SEEK_SET);
- read(fd, &iostat, sizeof(iostat));
-
- for (dp = iostat.dkstatp, cnt = iostat.dk_cnt;
- cnt && dp;
- --cnt, dp = dkstat.dknextp)
- {
- lseek(fd, (long)dp, SEEK_SET);
- read(fd, &dkstat, sizeof(dkstat));
-
- if (strEQ(diskio->name, dkstat.diskname)) {
- set_disk_metrics(&dkstat, fsusage);
- diskio->addr = (long)dp;
- break;
- }
- }
-
- return SIGAR_OK;
-}
-
int sigar_disk_usage_get(sigar_t *sigar, const char *name,
sigar_disk_usage_t *usage)
{
perfstat_disk_t disk;
perfstat_id_t id;
- sigar_perfstat_init(sigar);
- if (!sigar->perfstat.disk) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, name);
- if (sigar->perfstat.disk(&id, &disk, 1) != 1) {
+ if (perfstat_disk(&id, &disk, sizeof(disk), 1) != 1) {
return ENOENT;
}
@@ -1827,7 +1308,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
if (!ent->value) {
return SIGAR_OK;
}
- get_disk_metrics(sigar, fsusage, (aix_diskio_t *)ent->value);
+ sigar_disk_usage_get(sigar, ((aix_diskio_t *)ent->value)->name, &fsusage->disk);
}
return SIGAR_OK;
@@ -1866,14 +1347,13 @@ static char *sigar_get_odm_model(sigar_t *sigar)
#define SIGAR_CPU_CACHE_SIZE \
(_system_configuration.L2_cache_size / 1024)
-static int sigar_get_cpu_mhz_perfstat(sigar_t *sigar)
+static int sigar_get_cpu_mhz(sigar_t *sigar)
{
- perfstat_cpu_total_t data;
+ if (sigar->cpu_mhz == SIGAR_FIELD_NOTIMPL) {
+ perfstat_cpu_total_t data;
- if (sigar_perfstat_init(sigar) == SIGAR_OK) {
- if (sigar->perfstat.cpu_total(&data) == 1) {
+ if (sigar_perfstat_cpu(&data) == 1) {
sigar->cpu_mhz = data.processorHZ / 1000000;
- return SIGAR_OK;
}
else {
sigar_log_printf(sigar, SIGAR_LOG_ERROR,
@@ -1882,32 +1362,6 @@ static int sigar_get_cpu_mhz_perfstat(sigar_t *sigar)
}
}
- return ENOENT;
-}
-
-static int sigar_get_cpu_mhz(sigar_t *sigar)
-{
- if (sigar->cpu_mhz == SIGAR_FIELD_NOTIMPL) {
- if (sigar_get_cpu_mhz_perfstat(sigar) != SIGAR_OK) {
- sigar_uint64_t cache_size = SIGAR_CPU_CACHE_SIZE;
-
- switch (cache_size) {
- case 1024:
- sigar->cpu_mhz = 333;
- break;
- case 4096:
- sigar->cpu_mhz = 400;
- break;
- case 8192:
- sigar->cpu_mhz = 450;
- break;
- default:
- sigar->cpu_mhz = SIGAR_FIELD_NOTIMPL;
- break;
- }
- }
- }
-
return sigar->cpu_mhz;
}
@@ -2031,69 +1485,9 @@ int sigar_net_route_list_get(sigar_t *sigar,
return SIGAR_ENOTIMPL;
}
-static int sigar_net_interface_stat_get_kmem(sigar_t *sigar,
- const char *name,
- sigar_net_interface_stat_t *ifstat)
-{
- int status;
- struct ifnet data;
- caddr_t offset = 0;
- char if_name[32];
-
- sigar_log(sigar, SIGAR_LOG_DEBUG, "[ifstat] using /dev/kmem");
-
- status = kread(sigar, &offset, sizeof(offset),
- sigar->koffsets[KOFFSET_IFNET]);
-
- if (status != SIGAR_OK) {
- return status;
- }
-
- for (; offset; offset = (caddr_t)data.if_next) {
- status = kread(sigar, &data, sizeof(data), (long)offset);
-
- if (status != SIGAR_OK) {
- return status;
- }
-
- status = kread(sigar, if_name, sizeof(if_name),
- (long)&data.if_name[0]);
-
- if (status != SIGAR_OK) {
- return status;
- }
-
- /* XXX if_name is 'en' or 'lo', not 'en0' or 'lo0' */
- if (!strnEQ(if_name, name, strlen(if_name))) {
- continue;
- }
-
- ifstat->rx_bytes = data.if_ibytes;
- ifstat->rx_packets = data.if_ipackets;
- ifstat->rx_errors = data.if_ierrors;
- ifstat->rx_dropped = data.if_iqdrops;
- ifstat->rx_overruns = SIGAR_FIELD_NOTIMPL;
- ifstat->rx_frame = SIGAR_FIELD_NOTIMPL;
-
- ifstat->tx_bytes = data.if_obytes;
- ifstat->tx_packets = data.if_opackets;
- ifstat->tx_errors = data.if_oerrors;
- ifstat->tx_dropped = SIGAR_FIELD_NOTIMPL;
- ifstat->tx_overruns = SIGAR_FIELD_NOTIMPL;
- ifstat->tx_collisions = data.if_collisions;
- ifstat->tx_carrier = SIGAR_FIELD_NOTIMPL;
-
- ifstat->speed = data.if_baudrate;
-
- return SIGAR_OK;
- }
-
- return ENXIO;
-}
-
-static int sigar_net_interface_stat_get_perfstat(sigar_t *sigar,
- const char *name,
- sigar_net_interface_stat_t *ifstat)
+int sigar_net_interface_stat_get(sigar_t *sigar,
+ const char *name,
+ sigar_net_interface_stat_t *ifstat)
{
perfstat_id_t id;
perfstat_netinterface_t data;
@@ -2102,7 +1496,7 @@ static int sigar_net_interface_stat_get_perfstat(sigar_t *sigar,
SIGAR_SSTRCPY(id.name, name);
- if (sigar->perfstat.ifstat(&id, &data) == 1) {
+ if (perfstat_netinterface(&id, &data, sizeof(data), 1) == 1) {
ifstat->rx_bytes = data.ibytes;
ifstat->rx_packets = data.ipackets;
ifstat->rx_errors = data.ierrors;
@@ -2122,27 +1516,8 @@ static int sigar_net_interface_stat_get_perfstat(sigar_t *sigar,
return SIGAR_OK;
}
-
- if (SIGAR_LOG_IS_DEBUG(sigar)) {
- sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
- "[ifstat] dev=%s query failed: %s",
- name,
- sigar_strerror(sigar, errno));
- }
-
- return sigar_net_interface_stat_get_kmem(sigar, name, ifstat);
-}
-
-int sigar_net_interface_stat_get(sigar_t *sigar, const char *name,
- sigar_net_interface_stat_t *ifstat)
-{
- sigar_perfstat_init(sigar);
-
- if (sigar->perfstat.ifstat) {
- return sigar_net_interface_stat_get_perfstat(sigar, name, ifstat);
- }
else {
- return sigar_net_interface_stat_get_kmem(sigar, name, ifstat);
+ return errno;
}
}
@@ -2286,13 +1661,9 @@ sigar_tcp_get(sigar_t *sigar,
perfstat_id_t id;
perfstat_protocol_t proto;
- if (sigar_perfstat_init(sigar) != SIGAR_OK) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, "tcp");
- if (sigar->perfstat.protocol(&id, &proto, 1) != 1) {
+ if (perfstat_protocol(&id, &proto, sizeof(proto), 1) != 1) {
return ENOENT;
}
@@ -2334,13 +1705,9 @@ int sigar_nfs_client_v2_get(sigar_t *sigar,
perfstat_id_t id;
perfstat_protocol_t proto;
- if (sigar_perfstat_init(sigar) != SIGAR_OK) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, "nfsv2");
- if (sigar->perfstat.protocol(&id, &proto, 1) != 1) {
+ if (perfstat_protocol(&id, &proto, sizeof(proto), 1) != 1) {
return ENOENT;
}
@@ -2355,13 +1722,9 @@ int sigar_nfs_server_v2_get(sigar_t *sigar,
perfstat_id_t id;
perfstat_protocol_t proto;
- if (sigar_perfstat_init(sigar) != SIGAR_OK) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, "nfsv2");
- if (sigar->perfstat.protocol(&id, &proto, 1) != 1) {
+ if (perfstat_protocol(&id, &proto, sizeof(proto), 1) != 1) {
return ENOENT;
}
@@ -2400,13 +1763,9 @@ int sigar_nfs_client_v3_get(sigar_t *sigar,
perfstat_id_t id;
perfstat_protocol_t proto;
- if (sigar_perfstat_init(sigar) != SIGAR_OK) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, "nfsv3");
- if (sigar->perfstat.protocol(&id, &proto, 1) != 1) {
+ if (perfstat_protocol(&id, &proto, sizeof(proto), 1) != 1) {
return ENOENT;
}
@@ -2421,13 +1780,9 @@ int sigar_nfs_server_v3_get(sigar_t *sigar,
perfstat_id_t id;
perfstat_protocol_t proto;
- if (sigar_perfstat_init(sigar) != SIGAR_OK) {
- return SIGAR_ENOTIMPL;
- }
-
SIGAR_SSTRCPY(id.name, "nfsv3");
- if (sigar->perfstat.protocol(&id, &proto, 1) != 1) {
+ if (perfstat_protocol(&id, &proto, sizeof(proto), 1) != 1) {
return ENOENT;
}
diff --git a/src/os/aix/libperfstat.h b/src/os/aix/libperfstat.h
deleted file mode 100644
index e868da4f..00000000
--- a/src/os/aix/libperfstat.h
+++ /dev/null
@@ -1,542 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* bos52B src/bos/usr/ccs/lib/libperfstat/libperfstat.h 1.4.1.6 */
-/* */
-/* Licensed Materials - Property of IBM */
-/* */
-/* Restricted Materials of IBM */
-/* */
-/* (C) COPYRIGHT International Business Machines Corp. 2000,2003 */
-/* All Rights Reserved */
-/* */
-/* US Government Users Restricted Rights - Use, duplication or */
-/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */
-/* */
-/* IBM_PROLOG_END_TAG */
-/*
- * @(#)91 1.4.1.6 src/bos/usr/ccs/lib/libperfstat/libperfstat.h, libperfstat, bos52B, b2003_06F6 2/6/03 06:43:34
- * LEVEL 1, 5 Years Bull Confidential Information
- *
- */
-#ifndef LIBPERFSTAT_H
-#define LIBPERFSTAT_H
-
-/* This file describes the structures and constants used by the libperfstat API */
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define IDENTIFIER_LENGTH 64 /* length of strings included in the structures */
-
-#define FIRST_CPU "" /* pseudo-name for the first logical cpu */
-#define FIRST_DISK "" /* pseudo-name for the first disk */
-#define FIRST_DISKPATH "" /* pseudo-name for the first disk path */
-#define FIRST_DISKADAPTER "" /* pseudo-name for the first disk adapter */
-#define FIRST_NETINTERFACE "" /* pseudo-name for the first network interface */
-#define FIRST_PAGINGSPACE "" /* pseudo-name for the first paging space */
-#define FIRST_PROTOCOL "" /* pseudo-name for the first protocol */
-#define FIRST_NETBUFFER "" /* pseudo-name for the first network buffer size */
-
-#define DEFAULT_DEF "not available"
-
-typedef struct { /* structure element identifier */
- char name[IDENTIFIER_LENGTH]; /* name of the identifier */
-} perfstat_id_t;
-
-typedef struct { /* cpu information */
- char name[IDENTIFIER_LENGTH]; /* logical processor name (cpu0, cpu1, ..) */
- u_longlong_t user; /* raw number of clock ticks spent in user mode */
- u_longlong_t sys; /* raw number of clock ticks spent in system mode */
- u_longlong_t idle; /* raw number of clock ticks spent idle */
- u_longlong_t wait; /* raw number of clock ticks spent waiting for I/O */
- u_longlong_t pswitch; /* number of context switches (changes of currently running process) */
- u_longlong_t syscall; /* number of system calls executed */
- u_longlong_t sysread; /* number of read system calls executed */
- u_longlong_t syswrite; /* number of write system calls executed */
- u_longlong_t sysfork; /* number of fork system call executed */
- u_longlong_t sysexec; /* number of exec system call executed */
- u_longlong_t readch; /* number of characters tranferred with read system call */
- u_longlong_t writech; /* number of characters tranferred with write system call */
- u_longlong_t bread; /* number of block reads */
- u_longlong_t bwrite; /* number of block writes */
- u_longlong_t lread; /* number of logical read requests */
- u_longlong_t lwrite; /* number of logical write requests */
- u_longlong_t phread; /* number of physical reads (reads on raw device) */
- u_longlong_t phwrite; /* number of physical writes (writes on raw device) */
- u_longlong_t iget; /* number of inode lookups */
- u_longlong_t namei; /* number of vnode lookup from a path name */
- u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */
- u_longlong_t msg; /* number of IPC message operations */
- u_longlong_t sema; /* number of IPC semaphore operations */
-} perfstat_cpu_t;
-
-typedef struct { /* global cpu information */
- int ncpus; /* number of active logical processors */
- int ncpus_cfg; /* number of configured processors */
- char description[IDENTIFIER_LENGTH]; /* processor description (type/official name) */
- u_longlong_t processorHZ; /* processor speed in Hz */
- u_longlong_t user; /* raw total number of clock ticks spent in user mode */
- u_longlong_t sys; /* raw total number of clock ticks spent in system mode */
- u_longlong_t idle; /* raw total number of clock ticks spent idle */
- u_longlong_t wait; /* raw total number of clock ticks spent waiting for I/O */
- u_longlong_t pswitch; /* number of process switches (change in currently running process) */
- u_longlong_t syscall; /* number of system calls executed */
- u_longlong_t sysread; /* number of read system calls executed */
- u_longlong_t syswrite; /* number of write system calls executed */
- u_longlong_t sysfork; /* number of forks system calls executed */
- u_longlong_t sysexec; /* number of execs system calls executed */
- u_longlong_t readch; /* number of characters tranferred with read system call */
- u_longlong_t writech; /* number of characters tranferred with write system call */
- u_longlong_t devintrs; /* number of device interrupts */
- u_longlong_t softintrs; /* number of software interrupts */
- time_t lbolt; /* number of ticks since last reboot */
- u_longlong_t loadavg[3]; /* (1<. */
- u_longlong_t runque; /* length of the run queue (processes ready) */
- u_longlong_t swpque; /* ength of the swap queue (processes waiting to be paged in) */
- u_longlong_t bread; /* number of blocks read */
- u_longlong_t bwrite; /* number of blocks written */
- u_longlong_t lread; /* number of logical read requests */
- u_longlong_t lwrite; /* number of logical write requests */
- u_longlong_t phread; /* number of physical reads (reads on raw devices) */
- u_longlong_t phwrite; /* number of physical writes (writes on raw devices) */
- u_longlong_t runocc; /* updated whenever runque is updated, i.e. the runqueue is occupied.
- * This can be used to compute the simple average of ready processes */
- u_longlong_t swpocc; /* updated whenever swpque is updated. i.e. the swpqueue is occupied.
- * This can be used to compute the simple average processes waiting to be paged in */
- u_longlong_t iget; /* number of inode lookups */
- u_longlong_t namei; /* number of vnode lookup from a path name */
- u_longlong_t dirblk; /* number of 512-byte block reads by the directory search routine to locate an entry for a file */
- u_longlong_t msg; /* number of IPC message operations */
- u_longlong_t sema; /* number of IPC semaphore operations */
- u_longlong_t rcvint; /* number of tty receive interrupts */
- u_longlong_t xmtint; /* number of tyy transmit interrupts */
- u_longlong_t mdmint; /* number of modem interrupts */
- u_longlong_t tty_rawinch; /* number of raw input characters */
- u_longlong_t tty_caninch; /* number of canonical input characters (always zero) */
- u_longlong_t tty_rawoutch;/* number of raw output characters */
- u_longlong_t ksched; /* number of kernel processes created */
- u_longlong_t koverf; /* kernel process creation attempts where:
- * -the user has forked to their maximum limit
- * -the configuration limit of processes has been reached */
- u_longlong_t kexit; /* number of kernel processes that became zombies */
- u_longlong_t rbread; /* number of remote read requests */
- u_longlong_t rcread; /* number of cached remote reads */
- u_longlong_t rbwrt; /* number of remote writes */
- u_longlong_t rcwrt; /* number of cached remote writes */
- u_longlong_t traps; /* number of traps */
- int ncpus_high; /* index of highest processor online */
-} perfstat_cpu_total_t;
-
-typedef struct { /* disk information */
- char name[IDENTIFIER_LENGTH]; /* name of the disk */
- char description[IDENTIFIER_LENGTH]; /* disk description (from ODM) */
- char vgname[IDENTIFIER_LENGTH]; /* volume group name (from ODM) */
- u_longlong_t size; /* size of the disk (in MB) */
- u_longlong_t free; /* free portion of the disk (in MB) */
- u_longlong_t bsize; /* disk block size (in bytes) */
- u_longlong_t xrate; /* kbytes/sec xfer rate capability */
- u_longlong_t xfers; /* number of transfers to/from disk */
- u_longlong_t wblks; /* number of blocks written to disk */
- u_longlong_t rblks; /* number of blocks read from disk */
- u_longlong_t qdepth; /* queue depth */
- u_longlong_t time; /* amount of time disk is active */
- char adapter[IDENTIFIER_LENGTH]; /* disk adapter name (from ODM) */
- uint paths_count; /* number of paths defined to the disk */
-} perfstat_disk_t;
-
-typedef struct { /* global disk information */
- int number; /* total number of disks */
- u_longlong_t size; /* total size of all disks (in MB) */
- u_longlong_t free; /* free portion of all disks (in MB) */
- u_longlong_t xrate; /* total kbytes/sec xfer rate capability */
- u_longlong_t xfers; /* total number of transfers to/from disk */
- u_longlong_t wblks; /* 512 bytes blocks written to all disks */
- u_longlong_t rblks; /* 512 bytes blocks read from all disks */
- u_longlong_t time; /* amount of time disks are active */
-} perfstat_disk_total_t;
-
-typedef struct { /* Disk adapter information */
- char name[IDENTIFIER_LENGTH]; /* name of the adapter (from ODM) */
- char description[IDENTIFIER_LENGTH]; /* adapter description (from ODM) */
- int number; /* number of disks connected to adapter */
- u_longlong_t size; /* total size of all disks (in MB) */
- u_longlong_t free; /* free portion of all disks (in MB) */
- u_longlong_t xrate; /* total kbytes/sec xfer rate capability */
- u_longlong_t xfers; /* total number of transfers to/from disk */
- u_longlong_t rblks; /* 512 bytes blocks written via adapter */
- u_longlong_t wblks; /* 512 bytes blocks read via adapter */
- u_longlong_t time; /* amount of time disks are active */
-} perfstat_diskadapter_t;
-
-typedef struct { /* mpio information */
- char name[IDENTIFIER_LENGTH]; /* name of the path */
- u_longlong_t xrate; /* total kbytes/sec xfer rate capability */
- u_longlong_t xfers; /* total number of transfers via the path */
- u_longlong_t rblks; /* 512 bytes blocks written via the path */
- u_longlong_t wblks; /* 512 bytes blocks read via the path */
- u_longlong_t time; /* amount of time disks are active */
- char adapter[IDENTIFIER_LENGTH]; /* disk adapter name (from ODM) */
-} perfstat_diskpath_t;
-
-typedef struct { /* Virtual memory utilization */
- u_longlong_t virt_total; /* total virtual memory (in 4KB pages) */
- u_longlong_t real_total; /* total real memory (in 4KB pages) */
- u_longlong_t real_free; /* free real memory (in 4KB pages) */
- u_longlong_t real_pinned; /* real memory which is pinned (in 4KB pages) */
- u_longlong_t real_inuse; /* real memory which is in use (in 4KB pages) */
- u_longlong_t pgbad; /* number of bad pages */
- u_longlong_t pgexct; /* number of page faults */
- u_longlong_t pgins; /* number of pages paged in */
- u_longlong_t pgouts; /* number of pages paged out */
- u_longlong_t pgspins; /* number of page ins from paging space */
- u_longlong_t pgspouts; /* number of page outs from paging space */
- u_longlong_t scans; /* number of page scans by clock */
- u_longlong_t cycles; /* number of page replacement cycles */
- u_longlong_t pgsteals; /* number of page steals */
- u_longlong_t numperm; /* number of frames used for files (in 4KB pages) */
- u_longlong_t pgsp_total; /* total paging space (in 4KB pages) */
- u_longlong_t pgsp_free; /* free paging space (in 4KB pages) */
- u_longlong_t pgsp_rsvd; /* reserved paging space (in 4KB pages) */
- u_longlong_t real_system; /* real memory used by system segments (in 4KB pages). This is the sum of all the used pages in segment marked for system usage.
- * Since segment classifications are not always guaranteed to be accurate, this number is only an approximation. */
- u_longlong_t real_user; /* real memory used by non-system segments (in 4KB pages). This is the sum of all pages used in segments not marked for system usage.
- * Since segment classifications are not always guaranteed to be accurate, this number is only an approximation. */
- u_longlong_t real_process; /* real memory used by process segments (in 4KB pages). This is real_total-real_free-numperm-real_system. Since real_system is an
- * approximation, this number is too. */
-
-} perfstat_memory_total_t;
-
-typedef struct { /* Description of the network interface */
- char name[IDENTIFIER_LENGTH]; /* name of the interface */
- char description[IDENTIFIER_LENGTH]; /* interface description (from ODM, similar to lscfg output) */
- uchar type; /* ethernet, tokenring, etc. interpretation can be done using /usr/include/net/if_types.h */
- u_longlong_t mtu; /* network frame size */
- u_longlong_t ipackets; /* number of packets received on interface */
- u_longlong_t ibytes; /* number of bytes received on interface */
- u_longlong_t ierrors; /* number of input errors on interface */
- u_longlong_t opackets; /* number of packets sent on interface */
- u_longlong_t obytes; /* number of bytes sent on interface */
- u_longlong_t oerrors; /* number of output errors on interface */
- u_longlong_t collisions; /* number of collisions on csma interface */
- u_longlong_t bitrate; /* adapter rating in bit per second */
-} perfstat_netinterface_t;
-
-typedef struct { /* Description of the network interfaces */
- int number; /* number of network interfaces */
- u_longlong_t ipackets; /* number of packets received on interface */
- u_longlong_t ibytes; /* number of bytes received on interface */
- u_longlong_t ierrors; /* number of input errors on interface */
- u_longlong_t opackets; /* number of packets sent on interface */
- u_longlong_t obytes; /* number of bytes sent on interface */
- u_longlong_t oerrors; /* number of output errors on interface */
- u_longlong_t collisions; /* number of collisions on csma interface */
-} perfstat_netinterface_total_t;
-
-enum {
- LV_PAGING=1,
- NFS_PAGING
-};
-
-typedef struct { /* Paging space data for a specific logical volume */
- char name[IDENTIFIER_LENGTH]; /* Paging space name */
- char type; /* type of paging device (LV_PAGING or NFS_PAGING) *
- * Possible values are: *
- * LV_PAGING logical volume *
- * NFS_PAGING NFS file */
- union{
- struct{
- char hostname[IDENTIFIER_LENGTH]; /* host name of paging server */
- char filename[IDENTIFIER_LENGTH]; /* swap file name on server */
- } nfs_paging;
- struct{
- char vgname[IDENTIFIER_LENGTH];/* volume group name */
- } lv_paging;
- } id;
- longlong_t lp_size; /* size in number of logical partitions */
- longlong_t mb_size; /* size in megabytes */
- longlong_t mb_used; /* portion used in megabytes */
- longlong_t io_pending; /* number of pending I/O */
- char active; /* indicates if active (1 if so, 0 if not) */
- char automatic; /* indicates if automatic (1 if so, 0 if not) */
-} perfstat_pagingspace_t;
-
-typedef struct { /* network buffers */
- char name[IDENTIFIER_LENGTH]; /* size in ascii, always power of 2 (ex: "32", "64", "128") */
- u_longlong_t inuse; /* number of buffer currently allocated */
- u_longlong_t calls; /* number of buffer allocations since last reset */
- u_longlong_t delayed; /* number of delayed allocations */
- u_longlong_t free; /* number of free calls */
- u_longlong_t failed; /* number of failed allocations */
- u_longlong_t highwatermark; /* high threshold for number of buffer allocated */
- u_longlong_t freed; /* number of buffers freed */
-} perfstat_netbuffer_t;
-
-typedef struct { /* utilization of protocols */
- char name[IDENTIFIER_LENGTH]; /* ip, ipv6, icmp, icmpv6, udp, tcp, rpc, nfs, nfsv2, nfsv3*/
- union{
- struct{
- u_longlong_t ipackets; /* number of input packets */
- u_longlong_t ierrors; /* number of input errors */
- u_longlong_t iqueueoverflow; /* number of input queue overflows */
- u_longlong_t opackets; /* number of output packets */
- u_longlong_t oerrors; /* number of output errors */
- } ip;
- struct{
- u_longlong_t ipackets; /* number of input packets */
- u_longlong_t ierrors; /* number of input errors */
- u_longlong_t iqueueoverflow; /* number of input queue overflows */
- u_longlong_t opackets; /* number of output packets */
- u_longlong_t oerrors; /* number of output errors */
- } ipv6;
- struct{
- u_longlong_t received; /* number of packets received */
- u_longlong_t sent; /* number of packets sent */
- u_longlong_t errors; /* number of errors */
- } icmp;
- struct{
- u_longlong_t received; /* number of packets received */
- u_longlong_t sent; /* number of packets sent */
- u_longlong_t errors; /* number of errors */
- } icmpv6;
- struct{
- u_longlong_t ipackets; /* number of input packets */
- u_longlong_t ierrors; /* number of input errors */
- u_longlong_t opackets; /* number of output packets */
- u_longlong_t no_socket; /* number of packets dropped due to no socket */
- } udp;
- struct{
- u_longlong_t ipackets; /* number of input packets */
- u_longlong_t ierrors; /* number of input errors */
- u_longlong_t opackets; /* number of output packets */
- u_longlong_t initiated; /* number of connections initiated */
- u_longlong_t accepted; /* number of connections accepted */
- u_longlong_t established; /* number of connections established */
- u_longlong_t dropped; /* number of connections dropped */
- } tcp;
- struct{
- struct{
- struct{
- u_longlong_t calls; /* total NFS client RPC connection-oriented calls */
- u_longlong_t badcalls; /* rejected NFS client RPC calls */
- u_longlong_t badxids; /* bad NFS client RPC call responses */
- u_longlong_t timeouts; /* timed out NFS client RPC calls with no reply */
- u_longlong_t newcreds; /* total NFS client RPC authentication refreshes */
- u_longlong_t badverfs; /* total NFS client RPC bad verifier in response */
- u_longlong_t timers; /* NFS client RPC timout greater than timeout value */
- u_longlong_t nomem; /* NFS client RPC calls memory allocation failure */
- u_longlong_t cantconn; /* failed NFS client RPC calls */
- u_longlong_t interrupts;/* NFS client RPC calls fail due to interrupt */
- } stream; /* connection oriented rpc client */
- struct{
- u_longlong_t calls; /* total NFS client RPC connectionless calls */
- u_longlong_t badcalls; /* rejected NFS client RPC calls */
- u_longlong_t retrans; /* retransmitted NFS client RPC calls */
- u_longlong_t badxids; /* bad NFS client RPC call responses */
- u_longlong_t timeouts; /* timed out NFS client RPC calls with no reply */
- u_longlong_t newcreds; /* total NFS client RPC authentication refreshes */
- u_longlong_t badverfs; /* total NFS client RPC bad verifier in response */
- u_longlong_t timers; /* NFS client RPC timout greater than timeout value */
- u_longlong_t nomem; /* NFS client RPC calls memory allocation failure */
- u_longlong_t cantsend; /* NFS client RPC calls not sent */
- } dgram; /* connection less rpc client */
- } client; /* rpc client */
- struct{
- struct{
- u_longlong_t calls; /* total NFS server RPC connection-oriented requests */
- u_longlong_t badcalls; /* rejected NFS server RPC requests */
- u_longlong_t nullrecv; /* NFS server RPC calls failed due to unavailable packet */
- u_longlong_t badlen; /* NFS server RPC requests failed due to bad length */
- u_longlong_t xdrcall; /* NFS server RPC requests failed due to bad header */
- u_longlong_t dupchecks;/* NFS server RPC calls found in request cache */
- u_longlong_t dupreqs; /* total NFS server RPC call duplicates */
- } stream; /* connection oriented rpc server */
- struct{
- u_longlong_t calls; /* total NFS server RPC connectionless requests */
- u_longlong_t badcalls; /* rejected NFS server RPC requests */
- u_longlong_t nullrecv; /* NFS server RPC calls failed due to unavailable packet */
- u_longlong_t badlen; /* NFS server RPC requests failed due to bad length */
- u_longlong_t xdrcall; /* NFS server RPC requests failed due to bad header */
- u_longlong_t dupchecks;/* NFS server RPC calls found in request cache */
- u_longlong_t dupreqs; /* total NFS server RPC call duplicates */
- } dgram; /* connection less rpc server */
- } server; /* rpc server*/
- } rpc;
- struct{
- struct{
- u_longlong_t calls; /* total NFS client requests */
- u_longlong_t badcalls; /* total NFS client failed calls */
- u_longlong_t clgets; /* total number of client nfs clgets */
- u_longlong_t cltoomany;/* total number of client nfs cltoomany */
-
- } client; /* nfs client */
- struct{
- u_longlong_t calls; /* total NFS server requests */
- u_longlong_t badcalls; /* total NFS server failed calls */
- u_longlong_t public_v2; /* total number of nfs version 2 server calls */
- u_longlong_t public_v3; /* total number of nfs version 3 server calls */
- } server; /* nfs server */
- } nfs;
- struct{
- struct{
- u_longlong_t calls; /* NFS V2 client requests */
- u_longlong_t null; /* NFS V2 client null requests */
- u_longlong_t getattr; /* NFS V2 client getattr requests */
- u_longlong_t setattr; /* NFS V2 client setattr requests */
- u_longlong_t root; /* NFS V2 client root requests */
- u_longlong_t lookup; /* NFS V2 client file name lookup requests */
- u_longlong_t readlink; /* NFS V2 client readlink requests */
- u_longlong_t read; /* NFS V2 client read requests */
- u_longlong_t writecache;/* NFS V2 client write cache requests */
- u_longlong_t write; /* NFS V2 client write requests */
- u_longlong_t create; /* NFS V2 client file creation requests */
- u_longlong_t remove; /* NFS V2 client file removal requests */
- u_longlong_t rename; /* NFS V2 client file rename requests */
- u_longlong_t link; /* NFS V2 client link creation requests */
- u_longlong_t symlink; /* NFS V2 client symbolic link creation requests */
- u_longlong_t mkdir; /* NFS V2 client directory creation requests */
- u_longlong_t rmdir; /* NFS V2 client directory removal requests */
- u_longlong_t readdir; /* NFS V2 client read-directory requests */
- u_longlong_t statfs; /* NFS V2 client file stat requests */
- } client; /* nfs2 client */
- struct{
- u_longlong_t calls; /* NFS V2 server requests */
- u_longlong_t null; /* NFS V2 server null requests */
- u_longlong_t getattr; /* NFS V2 server getattr requests */
- u_longlong_t setattr; /* NFS V2 server setattr requests */
- u_longlong_t root; /* NFS V2 server root requests */
- u_longlong_t lookup; /* NFS V2 server file name lookup requests */
- u_longlong_t readlink; /* NFS V2 server readlink requests */
- u_longlong_t read; /* NFS V2 server read requests */
- u_longlong_t writecache;/* NFS V2 server cache requests */
- u_longlong_t write; /* NFS V2 server write requests */
- u_longlong_t create; /* NFS V2 server file creation requests */
- u_longlong_t remove; /* NFS V2 server file removal requests */
- u_longlong_t rename; /* NFS V2 server file rename requests */
- u_longlong_t link; /* NFS V2 server link creation requests */
- u_longlong_t symlink; /* NFS V2 server symbolic link creation requests */
- u_longlong_t mkdir; /* NFS V2 server directory creation requests */
- u_longlong_t rmdir; /* NFS V2 server directory removal requests */
- u_longlong_t readdir; /* NFS V2 server read-directory requests */
- u_longlong_t statfs; /* NFS V2 server file stat requests */
- } server; /* nfsv2 server */
- } nfsv2;
- struct{
- struct{
- u_longlong_t calls; /* NFS V3 client calls */
- u_longlong_t null; /* NFS V3 client null requests */
- u_longlong_t getattr; /* NFS V3 client getattr requests */
- u_longlong_t setattr; /* NFS V3 client setattr requests */
- u_longlong_t lookup; /* NFS V3 client file name lookup requests */
- u_longlong_t access; /* NFS V3 client access requests */
- u_longlong_t readlink; /* NFS V3 client readlink requests */
- u_longlong_t read; /* NFS V3 client read requests */
- u_longlong_t write; /* NFS V3 client write requests */
- u_longlong_t create; /* NFS V3 client file creation requests */
- u_longlong_t mkdir; /* NFS V3 client directory creation requests */
- u_longlong_t symlink; /* NFS V3 client symbolic link creation requests */
- u_longlong_t mknod; /* NFS V3 client mknod creation requests */
- u_longlong_t remove; /* NFS V3 client file removal requests */
- u_longlong_t rmdir; /* NFS V3 client directory removal requests */
- u_longlong_t rename; /* NFS V3 client file rename requests */
- u_longlong_t link; /* NFS V3 client link creation requests */
- u_longlong_t readdir; /* NFS V3 client read-directory requests */
- u_longlong_t readdirplus; /* NFS V3 client read-directory plus requests */
- u_longlong_t fsstat; /* NFS V3 client file stat requests */
- u_longlong_t fsinfo; /* NFS V3 client file info requests */
- u_longlong_t pathconf; /* NFS V3 client path configure requests */
- u_longlong_t commit; /* NFS V3 client commit requests */
- } client; /* nfsv3 client */
- struct{
- u_longlong_t calls; /* NFS V3 server requests */
- u_longlong_t null; /* NFS V3 server null requests */
- u_longlong_t getattr; /* NFS V3 server getattr requests */
- u_longlong_t setattr; /* NFS V3 server setattr requests */
- u_longlong_t lookup; /* NFS V3 server file name lookup requests */
- u_longlong_t access; /* NFS V3 server file access requests */
- u_longlong_t readlink; /* NFS V3 server readlink requests */
- u_longlong_t read; /* NFS V3 server read requests */
- u_longlong_t write; /* NFS V3 server write requests */
- u_longlong_t create; /* NFS V3 server file creation requests */
- u_longlong_t mkdir; /* NFS V3 server director6 creation requests */
- u_longlong_t symlink; /* NFS V3 server symbolic link creation requests */
- u_longlong_t mknod; /* NFS V3 server mknode creation requests */
- u_longlong_t remove; /* NFS V3 server file removal requests */
- u_longlong_t rmdir; /* NFS V3 server directory removal requests */
- u_longlong_t rename; /* NFS V3 server file rename requests */
- u_longlong_t link; /* NFS V3 server link creation requests */
- u_longlong_t readdir; /* NFS V3 server read-directory requests */
- u_longlong_t readdirplus; /* NFS V3 server read-directory plus requests */
- u_longlong_t fsstat; /* NFS V3 server file stat requests */
- u_longlong_t fsinfo; /* NFS V3 server file info requests */
- u_longlong_t pathconf; /* NFS V3 server path configure requests */
- u_longlong_t commit; /* NFS V3 server commit requests */
- } server; /* nfsv3 server */
- } nfsv3;
- } u;
-} perfstat_protocol_t;
-
-extern int perfstat_cpu_total(perfstat_id_t *name,
- perfstat_cpu_total_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_cpu(perfstat_id_t *name,
- perfstat_cpu_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_disk_total(perfstat_id_t *name,
- perfstat_disk_total_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_disk(perfstat_id_t *name,
- perfstat_disk_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_diskadapter(perfstat_id_t *name,
- perfstat_diskadapter_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_diskpath(perfstat_id_t *name,
- perfstat_diskpath_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_memory_total(perfstat_id_t *name,
- perfstat_memory_total_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_netinterface_total(perfstat_id_t *name,
- perfstat_netinterface_total_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-extern int perfstat_netinterface(perfstat_id_t *name,
- perfstat_netinterface_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-
-extern int perfstat_pagingspace(perfstat_id_t *name,
- perfstat_pagingspace_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-
-extern int perfstat_netbuffer(perfstat_id_t *name,
- perfstat_netbuffer_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-
-extern int perfstat_protocol(perfstat_id_t *name,
- perfstat_protocol_t* userbuff,
- int sizeof_userbuff,
- int desired_number);
-
-extern void perfstat_reset(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*undef LIBPERFSTAT_H*/
-
diff --git a/src/os/aix/perfstat/build.xml b/src/os/aix/perfstat/build.xml
deleted file mode 100644
index 0b3f7e4a..00000000
--- a/src/os/aix/perfstat/build.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/os/aix/perfstat/libperfstat.a b/src/os/aix/perfstat/libperfstat.a
deleted file mode 100644
index 878b3817..00000000
Binary files a/src/os/aix/perfstat/libperfstat.a and /dev/null differ
diff --git a/src/os/aix/perfstat/libpthreads.a b/src/os/aix/perfstat/libpthreads.a
deleted file mode 100644
index b6db79d1..00000000
Binary files a/src/os/aix/perfstat/libpthreads.a and /dev/null differ
diff --git a/src/os/aix/perfstat/sigar_perfstat.c b/src/os/aix/perfstat/sigar_perfstat.c
deleted file mode 100644
index 5867e2bd..00000000
--- a/src/os/aix/perfstat/sigar_perfstat.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-
-#include
-#include
-
-/*
- * ibm docs say:
- * "name Must be set to NULL.
- * desired_number Must be set to 1."
- * so we just hardcode that in our wrapper.
- */
-int sigar_perfstat_cpu_total(perfstat_cpu_total_t *cpu_total)
-{
- return perfstat_cpu_total(NULL, cpu_total, sizeof(*cpu_total), 1);
-}
-
-int sigar_perfstat_cpu(perfstat_id_t *id,
- perfstat_cpu_t *cpu,
- int num)
-{
- return perfstat_cpu(id, cpu, sizeof(*cpu), num);
-}
-
-int sigar_perfstat_pagingspace(perfstat_id_t *id,
- perfstat_pagingspace_t *pagingspace,
- int num)
-{
- return perfstat_pagingspace(id, pagingspace, sizeof(*pagingspace), num);
-}
-
-int sigar_perfstat_memory(perfstat_memory_total_t *memory)
-{
- return perfstat_memory_total(NULL, memory, sizeof(*memory), 1);
-}
-
-int sigar_perfstat_disk(perfstat_id_t *id,
- perfstat_disk_t *disk,
- int num)
-{
- return perfstat_disk(id, disk, sizeof(*disk), num);
-}
-
-int sigar_perfstat_diskadapter(perfstat_id_t *id,
- perfstat_diskadapter_t *adapter,
- int num)
-{
- return perfstat_diskadapter(id, adapter, sizeof(*adapter), num);
-}
-
-int sigar_perfstat_diskpath(perfstat_id_t *id,
- perfstat_diskpath_t *diskpath,
- int num)
-{
- return perfstat_diskpath(id, diskpath, sizeof(*diskpath), num);
-}
-
-int sigar_perfstat_netinterface(perfstat_id_t *id,
- perfstat_netinterface_t *netinterface)
-
-{
- return perfstat_netinterface(id, netinterface,
- sizeof(*netinterface), 1);
-}
-
-int sigar_perfstat_netbuffer(perfstat_id_t *id,
- perfstat_netbuffer_t *netbuffer,
- int num)
-{
- return perfstat_netbuffer(id, netbuffer, sizeof(*netbuffer), num);
-}
-
-int sigar_perfstat_protocol(perfstat_id_t *id,
- perfstat_protocol_t *proto,
- int num)
-{
- return perfstat_protocol(id, proto, sizeof(*proto), num);
-}
-
-/*
- * not a perfstat function, but from libpthreads.a
- * requires the same tricks to link on 4.3 and run on 5.2
- */
-int sigar_thread_rusage(struct rusage *usage, int mode)
-{
- return pthread_getrusage_np(pthread_self(), usage, mode);
-}
diff --git a/src/os/aix/sigar_os.h b/src/os/aix/sigar_os.h
index b465e700..17ce10f8 100644
--- a/src/os/aix/sigar_os.h
+++ b/src/os/aix/sigar_os.h
@@ -25,8 +25,6 @@
#include
#include
-#include "libperfstat.h"
-
enum {
KOFFSET_LOADAVG,
KOFFSET_VAR,
@@ -46,50 +44,12 @@ typedef struct {
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 *);
-
-typedef int (*perfstat_cpu_func_t)(perfstat_id_t *,
- perfstat_cpu_t *,
- int);
-
-typedef int (*perfstat_swap_func_t)(perfstat_id_t *,
- perfstat_pagingspace_t *,
- int);
-
-typedef int (*perfstat_mem_func_t)(perfstat_memory_total_t *);
-
-typedef int (*perfstat_disk_func_t)(perfstat_id_t *,
- perfstat_disk_t *,
- int);
-
-typedef int (*perfstat_ifstat_func_t)(perfstat_id_t *,
- perfstat_netinterface_t *);
-
-typedef int (*perfstat_protocol_func_t)(perfstat_id_t *,
- perfstat_protocol_t *,
- int);
-
-typedef int (*thread_rusage_func_t)(struct rusage *, int);
-
struct sigar_t {
SIGAR_T_BASE;
int kmem;
- int dmem;
/* offsets for seeking on kmem */
long koffsets[KOFFSET_MAX];
proc_fd_func_t getprocfd;
- struct {
- int avail;
- perfstat_cpu_func_t cpu;
- perfstat_cpu_total_func_t cpu_total;
- perfstat_swap_func_t swap;
- perfstat_mem_func_t mem;
- perfstat_disk_func_t disk;
- perfstat_ifstat_func_t ifstat;
- perfstat_protocol_func_t protocol;
- thread_rusage_func_t thread_rusage;
- void *handle;
- } perfstat;
int pagesize;
swaps_t swaps;
time_t last_getprocs;