diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2012-03-22 01:38:38 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2012-03-22 01:38:38 +0000 |
| commit | ed35054b7bdc48d94ed7b99afd6126292d3c2437 (patch) | |
| tree | 183378e5242012f4b034a924b4daf91edd7c24e7 | |
| parent | 78d745850b22410ace8047c3ec85c15ae2b3c177 (diff) | |
| download | illumos-joyent-ed35054b7bdc48d94ed7b99afd6126292d3c2437.tar.gz | |
OS-1044 minimize prstat vm_getusage impact
| -rw-r--r-- | usr/src/cmd/prstat/prstat.c | 13 | ||||
| -rw-r--r-- | usr/src/cmd/prstat/prstat.h | 2 | ||||
| -rw-r--r-- | usr/src/cmd/prstat/prutil.c | 3 | ||||
| -rw-r--r-- | usr/src/man/man1m/prstat.1m | 23 |
4 files changed, 34 insertions, 7 deletions
diff --git a/usr/src/cmd/prstat/prstat.c b/usr/src/cmd/prstat/prstat.c index 5942cce360..ae02ee9cf8 100644 --- a/usr/src/cmd/prstat/prstat.c +++ b/usr/src/cmd/prstat/prstat.c @@ -24,6 +24,7 @@ * Use is subject to license terms. * * Portions Copyright 2009 Chad Mynhier + * Copyright 2012 Joyent, Inc. All rights reserved. */ #include <sys/types.h> @@ -230,7 +231,12 @@ list_getsize(list_t *list) size_t i; uint_t flags = 0; int ret; - size_t physmem = sysconf(_SC_PHYS_PAGES) * pagesize; + size_t physmem; + + if (!(opts.o_outpmode & OPT_VMUSAGE)) + return; + + physmem = sysconf(_SC_PHYS_PAGES) * pagesize; /* * Determine what swap/rss results to calculate. getvmusage() will @@ -1364,7 +1370,7 @@ main(int argc, char **argv) pagesize = sysconf(_SC_PAGESIZE); while ((opt = getopt(argc, argv, - "vcd:HmarRLtu:U:n:p:C:P:h:s:S:j:k:TJz:Z")) != (int)EOF) { + "vVcd:HmarRLtu:U:n:p:C:P:h:s:S:j:k:TJz:Z")) != (int)EOF) { switch (opt) { case 'r': opts.o_outpmode |= OPT_NORESOLVE; @@ -1442,6 +1448,9 @@ main(int argc, char **argv) while (p = strtok(NULL, ", ")) add_uid(&ruid_tbl, p); break; + case 'V': + opts.o_outpmode |= OPT_VMUSAGE; + break; case 'p': fill_table(&pid_tbl, optarg, 'p'); break; diff --git a/usr/src/cmd/prstat/prstat.h b/usr/src/cmd/prstat/prstat.h index eefddcfcc3..f75bdaf412 100644 --- a/usr/src/cmd/prstat/prstat.h +++ b/usr/src/cmd/prstat/prstat.h @@ -24,6 +24,7 @@ * Use is subject to license terms. * * Portions Copyright 2009 Chad Mynhier + * Copyright 2012 Joyent, Inc. All rights reserved. */ #ifndef _PRSTAT_H @@ -70,6 +71,7 @@ extern "C" { #define OPT_ZONES 0x2000 /* report about zones */ #define OPT_PSETS 0x4000 /* report for specified psets */ #define OPT_LGRP 0x8000 /* report home lgroups */ +#define OPT_VMUSAGE 0x10000 /* print accurate, but expensive RSS */ #define OPT_UDATE 0x20000 /* print unix timestamp */ #define OPT_DDATE 0x40000 /* print timestamp in date(1) format */ #define OPT_NORESOLVE 0x80000 /* no nsswitch lookups */ diff --git a/usr/src/cmd/prstat/prutil.c b/usr/src/cmd/prstat/prutil.c index 75db7c3b3b..6ff4f5c49f 100644 --- a/usr/src/cmd/prstat/prutil.c +++ b/usr/src/cmd/prstat/prutil.c @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Portions Copyright 2009 Chad Mynhier + * Copyright 2012 Joyent, Inc. All rights reserved. */ #include <sys/types.h> @@ -106,7 +107,7 @@ void Usage() { (void) fprintf(stderr, gettext( - "Usage:\tprstat [-acHJLmrRtTvZ] [-u euidlist] [-U uidlist]\n" + "Usage:\tprstat [-acHJLmrRtTvVZ] [-u euidlist] [-U uidlist]\n" "\t[-p pidlist] [-P cpulist] [-C psrsetlist] [-h lgrouplist]\n" "\t[-j projidlist] [-k taskidlist] [-z zoneidlist]\n" "\t[-s key | -S key] [-n nprocs[,nusers]] [-d d|u]\n" diff --git a/usr/src/man/man1m/prstat.1m b/usr/src/man/man1m/prstat.1m index b70124b9b8..adacc7f980 100644 --- a/usr/src/man/man1m/prstat.1m +++ b/usr/src/man/man1m/prstat.1m @@ -1,5 +1,6 @@ '\" te .\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright (c) 2012, Joyent, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] @@ -9,7 +10,7 @@ prstat \- report active process statistics .SH SYNOPSIS .LP .nf -\fBprstat\fR [\fB-acHJLmRrtTv\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR] +\fBprstat\fR [\fB-acHJLmRrtTvV\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR] [\fB-j\fR \fIprojlist\fR] [\fB-k\fR \fItasklist\fR] [\fB-n\fR \fIntop\fR[,\fInbottom\fR]] [\fB-p\fR \fIpidlist\fR] [\fB-P\fR \fIcpulist\fR] [\fB-s\fR \fIkey\fR | \fB-S\fR \fIkey\fR ] [\fB-u\fR \fIeuidlist\fR] [\fB-U\fR \fIuidlist\fR] [\fB-z\fR \fIzoneidlist\fR] [\fB-Z\fR] @@ -364,6 +365,18 @@ with the \fB-\fR sign. .sp .ne 2 .na +\fB\fB-V\fR\fR +.ad +.sp .6 +.RS 4n +Report accurate aggregated RSS values when used with the \fB-J\fR, \fB-t\fR, +\fB-T\fR or \fB-Z\fR options. This uses an accurate, but more expensive, +calculation to determine the aggregated RSS value for the specified grouping. +.RE + +.sp +.ne 2 +.na \fB\fB-z\fR \fIzoneidlist\fR\fR .ad .sp .6 @@ -429,9 +442,11 @@ devices, in kilobytes (\fBK\fR), megabytes (\fBM\fR), or gigabytes (\fBG\fR). .RS 4n The resident set size of the process (\fBRSS\fR), in kilobytes (\fBK\fR), megabytes (\fBM\fR), or gigabytes (\fBG\fR). The RSS value is an estimate -provided by \fBproc\fR(4) that might underestimate the actual resident set -size. Users who want to get more accurate usage information for capacity -planning should use the \fB-x\fR option to \fBpmap\fR(1) instead. +provided by \fBproc\fR(4) that might underestimate the actual +per-process resident set size and usually overestimates the aggregated +resident set size. Users who want to get more accurate usage information for +capacity planning should use either the \fB-V\fR option or, for per-process +results, the \fB-x\fR option to \fBpmap\fR(1) instead. .RE .sp |
