diff options
author | Donghai Qiao <Donghai.Qiao@Sun.COM> | 2010-02-15 17:20:13 -0500 |
---|---|---|
committer | Donghai Qiao <Donghai.Qiao@Sun.COM> | 2010-02-15 17:20:13 -0500 |
commit | c65c9cdc54c4ba51aeb34ab36b73286653013c8a (patch) | |
tree | 1b030011ba1aea2bd0240205a7dee6a890046b17 | |
parent | 8d265e661a88084e97824e4a5ef1a337c9beb663 (diff) | |
download | illumos-joyent-c65c9cdc54c4ba51aeb34ab36b73286653013c8a.tar.gz |
6882903 swap_avail and freemem of vmstat output occasionally generate spikes
-rw-r--r-- | usr/src/cmd/stat/vmstat/vmstat.c | 22 | ||||
-rw-r--r-- | usr/src/uts/common/os/clock.c | 3 | ||||
-rw-r--r-- | usr/src/uts/common/sys/sysinfo.h | 3 |
3 files changed, 16 insertions, 12 deletions
diff --git a/usr/src/cmd/stat/vmstat/vmstat.c b/usr/src/cmd/stat/vmstat/vmstat.c index 613284c82e..2f4aff5f17 100644 --- a/usr/src/cmd/stat/vmstat/vmstat.c +++ b/usr/src/cmd/stat/vmstat/vmstat.c @@ -1,5 +1,5 @@ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -259,7 +259,7 @@ dovmstats(struct snapshot *old, struct snapshot *new) kstat_t *oldvm = NULL; kstat_t *newvm = &new->s_sys.ss_agg_vm; double percent_factor; - ulong_t updates; + ulong_t sys_updates, vm_updates; int count; adj = 0; @@ -276,7 +276,8 @@ dovmstats(struct snapshot *old, struct snapshot *new) * If any time has passed, convert etime to seconds per CPU */ etime = etime >= 1.0 ? (etime / nr_active_cpus(new)) / hz : 1.0; - updates = denom(DELTA(s_sys.ss_sysinfo.updates)); + sys_updates = denom(DELTA(s_sys.ss_sysinfo.updates)); + vm_updates = denom(DELTA(s_sys.ss_vminfo.updates)); if (timestamp_fmt != NODATE) { print_timestamp(timestamp_fmt); @@ -290,9 +291,10 @@ dovmstats(struct snapshot *old, struct snapshot *new) if (pflag) { adjprintf(" %*u", 6, - pgtok((int)(DELTA(s_sys.ss_vminfo.swap_avail) / updates))); + pgtok((int)(DELTA(s_sys.ss_vminfo.swap_avail) + / vm_updates))); adjprintf(" %*u", 5, - pgtok((int)(DELTA(s_sys.ss_vminfo.freemem) / updates))); + pgtok((int)(DELTA(s_sys.ss_vminfo.freemem) / vm_updates))); adjprintf(" %*.0f", 3, kstat_delta(oldvm, newvm, "pgrec") / etime); adjprintf(" %*.0f", 3, (kstat_delta(oldvm, newvm, "hat_fault") + @@ -324,13 +326,13 @@ dovmstats(struct snapshot *old, struct snapshot *new) return; } - adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.runque) / updates); - adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.waiting) / updates); - adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.swpque) / updates); + adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.runque) / sys_updates); + adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.waiting) / sys_updates); + adjprintf(" %*lu", 1, DELTA(s_sys.ss_sysinfo.swpque) / sys_updates); adjprintf(" %*u", 6, pgtok((int)(DELTA(s_sys.ss_vminfo.swap_avail) - / updates))); + / vm_updates))); adjprintf(" %*u", 5, pgtok((int)(DELTA(s_sys.ss_vminfo.freemem) - / updates))); + / vm_updates))); adjprintf(" %*.0f", 3, swflag? kstat_delta(oldvm, newvm, "swapin") / etime : kstat_delta(oldvm, newvm, "pgrec") / etime); diff --git a/usr/src/uts/common/os/clock.c b/usr/src/uts/common/os/clock.c index dda80d0406..0f7982a80a 100644 --- a/usr/src/uts/common/os/clock.c +++ b/usr/src/uts/common/os/clock.c @@ -828,7 +828,6 @@ clock(void) */ cv_broadcast(&lbolt_cv); - sysinfo.updates++; vminfo.freemem += freemem; { pgcnt_t maxswap, resv, free; @@ -853,6 +852,7 @@ clock(void) vminfo.swap_avail += maxswap - resv; vminfo.swap_free += free; } + vminfo.updates++; if (nrunnable) { sysinfo.runque += nrunnable; sysinfo.runocc++; @@ -862,6 +862,7 @@ clock(void) sysinfo.swpocc++; } sysinfo.waiting += w_io; + sysinfo.updates++; /* * Wake up fsflush to write out DELWRI diff --git a/usr/src/uts/common/sys/sysinfo.h b/usr/src/uts/common/sys/sysinfo.h index 6cea00e946..c0f817d77b 100644 --- a/usr/src/uts/common/sys/sysinfo.h +++ b/usr/src/uts/common/sys/sysinfo.h @@ -23,7 +23,7 @@ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -182,6 +182,7 @@ typedef struct vminfo { /* (update freq) update action */ uint64_t swap_alloc; /* (1 sec) += allocated swap in pages */ uint64_t swap_avail; /* (1 sec) += unreserved swap in pages */ uint64_t swap_free; /* (1 sec) += unallocated swap in pages */ + uint64_t updates; /* (1 sec) ++ */ } vminfo_t; typedef struct cpu_stat { |