From 165e7d6a9967db1115fff5a9d248d98800ad4e45 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 17 Jan 2007 18:14:14 +0000 Subject: [PATCH] fix cpu metrics for sparc64 and change loadavg back to using ui32 --- src/os/solaris/sigar_os.h | 16 ++++++++++++---- src/os/solaris/solaris_sigar.c | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/os/solaris/sigar_os.h b/src/os/solaris/sigar_os.h index e54c8ac1..124fd005 100644 --- a/src/os/solaris/sigar_os.h +++ b/src/os/solaris/sigar_os.h @@ -259,11 +259,19 @@ struct sigar_t { #define KSTAT_UINT ui32 #endif -#define kSTAT_uint(v, type) \ - ((sigar->koffsets.type[v] == -2) ? 0 : \ - ((kstat_named_t *)ksp->ks_data + sigar->koffsets.type[v])->value.KSTAT_UINT) +#define kSTAT_exists(v, type) \ + (sigar->koffsets.type[v] != -2) -#define kSYSTEM(v) kSTAT_uint(v, system) +#define kSTAT_ptr(v, type) \ + ((kstat_named_t *)ksp->ks_data + sigar->koffsets.type[v]) + +#define kSTAT_uint(v, type) \ + (kSTAT_exists(v, type) ? kSTAT_ptr(v, type)->value.KSTAT_UINT : 0) + +#define kSTAT_ui32(v, type) \ + (kSTAT_exists(v, type) ? kSTAT_ptr(v, type)->value.ui32 : 0) + +#define kSYSTEM(v) kSTAT_ui32(v, system) #define kMEMPAGES(v) kSTAT_uint(v, mempages) diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index 3e9761df..cf85eb7c 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -358,7 +358,7 @@ int sigar_cpu_list_get(sigar_t *sigar, sigar_cpu_list_t *cpulist) { kstat_ctl_t *kc = sigar->kc; kstat_t *ksp; - ulong cpuinfo[CPU_STATES]; + uint_t cpuinfo[CPU_STATES]; unsigned int i; int is_debug = SIGAR_LOG_IS_DEBUG(sigar); int reported_virtual = 0;