diff --git a/qa/1989 b/qa/1989 index 346ea8c8a3..339078f7ab 100755 --- a/qa/1989 +++ b/qa/1989 @@ -1,4 +1,3 @@ -@@ -0,0 +1,39 @@ #!/bin/sh # PCP QA Test No. 1989 # Exercise various pcp-slabinfo(1) command options. @@ -23,6 +22,7 @@ status=1 # failure is the default! $sudo rm -rf $tmp.* $seq.full trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15 +pcp_slabinfo="$PCP_BINADM_DIR/pcp-slabinfo" test -x $pcp_slabinfo || _notrun "No pcp-slabinfo(1) installed" pcp_slabinfo="$python $pcp_slabinfo" diff --git a/qa/archives/GNUmakefile b/qa/archives/GNUmakefile index 241a9d707c..4bad4b15db 100644 --- a/qa/archives/GNUmakefile +++ b/qa/archives/GNUmakefile @@ -47,8 +47,8 @@ DEFLATE = small.0.xz small.meta small.index \ pcp-pidstat-process-states.index pcp-pidstat-process-args.0.xz \ pcp-pidstat-process-args.index pcp-pidstat-process-args.meta.xz \ pcp-pidstat-timezone.0.xz pcp-pidstat-timezone.meta.xz \ - pcp-pidstat-timezone.index pcp-slabinfo.0 pcp-slabinfo.index \ - pcp-slabinfo.meta zero_disk_activity.index \ + pcp-pidstat-timezone.index pcp-slabinfo.0.xz pcp-slabinfo.index.xz \ + pcp-slabinfo.meta.xz zero_disk_activity.index \ zero_disk_activity.0.xz zero_disk_activity.meta.xz \ dstat-disks.0.xz dstat-disks.meta.xz dstat-disks.index \ dstat-diskfarm.0.xz dstat-diskfarm.meta.xz dstat-diskfarm.index \ diff --git a/qa/archives/mk.slabinfo b/qa/archives/mk.slabinfo index 1f556be253..012c60bfa6 100755 --- a/qa/archives/mk.slabinfo +++ b/qa/archives/mk.slabinfo @@ -31,6 +31,15 @@ log advisory on 10 seconds { } End-of-File -rm -f pcp-slabinfo.0 pcp-slabinfo.index pcp-slabinfo.meta +rm -f pcp-slabinfo.0 pcp-slabinfo.index pcp-slabinfo.meta pcp-slabinfo.* + +if pmlogger -T 60sec -t 10sec -c $tmp.config pcp-slabinfo; then + xz pcp-slabinfo.0 + xz pcp-slabinfo.index + xz pcp-slabinfo.meta +else + echo "Argh: pmlogger failed ..." + cat pmlogger.log +fi + -pmlogger -T 60sec -t 10sec -c $tmp.config pcp-slabinfo diff --git a/qa/archives/pcp-slabinfo.0 b/qa/archives/pcp-slabinfo.0 deleted file mode 100644 index c0837416ef..0000000000 Binary files a/qa/archives/pcp-slabinfo.0 and /dev/null differ diff --git a/qa/archives/pcp-slabinfo.0.xz b/qa/archives/pcp-slabinfo.0.xz new file mode 100644 index 0000000000..0cfd128b89 Binary files /dev/null and b/qa/archives/pcp-slabinfo.0.xz differ diff --git a/qa/archives/pcp-slabinfo.index b/qa/archives/pcp-slabinfo.index deleted file mode 100644 index 6c3894cf94..0000000000 Binary files a/qa/archives/pcp-slabinfo.index and /dev/null differ diff --git a/qa/archives/pcp-slabinfo.index.xz b/qa/archives/pcp-slabinfo.index.xz new file mode 100644 index 0000000000..862730de60 Binary files /dev/null and b/qa/archives/pcp-slabinfo.index.xz differ diff --git a/qa/archives/pcp-slabinfo.meta b/qa/archives/pcp-slabinfo.meta deleted file mode 100644 index 29c20ac674..0000000000 Binary files a/qa/archives/pcp-slabinfo.meta and /dev/null differ diff --git a/qa/archives/pcp-slabinfo.meta.xz b/qa/archives/pcp-slabinfo.meta.xz new file mode 100644 index 0000000000..d4188d2b91 Binary files /dev/null and b/qa/archives/pcp-slabinfo.meta.xz differ diff --git a/src/pcp/slabinfo/pcp-slabinfo.1 b/src/pcp/slabinfo/pcp-slabinfo.1 index bf1543907a..b1d30cf378 100644 --- a/src/pcp/slabinfo/pcp-slabinfo.1 +++ b/src/pcp/slabinfo/pcp-slabinfo.1 @@ -1,3 +1,7 @@ +'\"! tbl | mmdoc +'\"macro stdmacro +.\" +.\" Man page for pcp-slabinfo .\" Copyright (c) 2023 Oracle and/or its affiliates. .\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. .\" @@ -11,105 +15,69 @@ .\" or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License .\" for more details. .\" + .TH PCP-SLABINFO 1 "PCP" "Performance Co-Pilot" + .SH NAME -\f3pcp-slabinfo\f1 \- Report statistics for kernel slab allocator statistics +\fBpcp-slabinfo\fP \- Report statistics for kernel slab allocator statistics + .SH SYNOPSIS -\f3pcp\f1 -[\f2pcp\ options\f1] -\f3slabinfo\f1 -[\f3\-s\f1 \f2samples\f1] -[\f3\-a\f1 \f2archive\f1] -[\f3\-Z\f1 \f2--timezone\f1] -[\f3\-z\f1 \f2--hostzone\f1] -[\f3\-V\f1 \f2Version\f1] +\fBpcp\fP [\fBpcp options\fP] \fBslabinfo\fP [\fB-s\fP \fBsamples\fP] [\fB-a\fP \fBarchive\fP] [\fB-Z\fP \fB--timezone\fP] [\fB-z\fP \fB--hostzone\fP] [\fB-V\fP \fBVersion\fP] + .SH DESCRIPTION -The -.B pcp-slabinfo -command is used for viewing the different kinds of stats related to slab. -Using various options it helps a user to analyze useful information related to -the slab allocator. -This information includes total number of objects that are currently active,allocated objects, page per slab, etc. -By default -.B pcp-slabinfo -reports live data for the local host. -.br +The \fBpcp-slabinfo\fP command is used for viewing different stats related to slab. It helps users analyze useful information related to the slab allocator. The information includes the total number of objects that are currently active, allocated objects, pages per slab, etc. By default, \fBpcp-slabinfo\fP reports live data for the local host. + The statistics shown are as follows: + .TS lfB lfB l lx. -HEADER DESCRIPTION -_ _ _ -active_objs The number of objects that are currently active (i.e., in use) -num_objs T{ -.ad l -.hy 0 -The total number of allocated objects (i.e., objects that are both in use and not in use). -T} -objsize T{ -.ad l -.hy 0 -The size of objects in this slab, in bytes. -T} -objperslab T{ -.ad l -.hy 0 -The number of objects stored in each slab. -T} -pagesperslab T{ -.ad l -.hy 0 -The number of pages allocated for each slab -T} -active_slabs T{ -.ad l -.hy 0 -The number of active slabs. -T} -num_slabs T{ -.ad l -.hy 0 -The total number of slabs. -T} +HEADER DESCRIPTION +_ _ +active_objs The number of objects that are currently active (i.e., in use) +num_objs The total number of allocated objects (i.e., objects that are both in use and not in use). +objsize The size of objects in this slab, in bytes. +objperslab The number of objects stored in each slab. +pagesperslab The number of pages allocated for each slab +active_slabs The number of active slabs. +num_slabs The total number of slabs. .TE + .SH OPTIONS .TP -\fB\-a\fP, \fB\-\-archive\fP +\fB-a\fP, \fB\-\-archive\fP Fetch /proc/slabinfo for a specified archive file + .TP -\fB\-s\fP, \fB\-\-samples\fP -Get the slabinfo for specified number of samples count +\fB-s\fP, \fB\-\-samples\fP +Get the slabinfo for the specified number of samples count + .TP -\fB\-z\fP, \fB\-\-hostzone\fP -Set reporting timezone to local time of metrics source +\fB-z\fP, \fB\-\-hostzone\fP +Set the reporting timezone to the local time of metrics source + .TP -\fB\-Z\fP, \fB\-\-timezone\fP -set reporting timezone +\fB-Z\fP, \fB\-\-timezone\fP +Set the reporting timezone + .TP -\fB\-V\fR, \fB\-\-version\fR -Display version number and exit. +\fB-V\fP, \fB\-\-version\fP +Display the version number and exit. + .TP -\fB\-?\fR, \fB\-\-help\fR -Display usage message and exit. +\fB-?\fP, \fB\-\-help\fP +Display the usage message and exit. .SH NOTES -.B pcp-slabinfo -collects information from -.BR /proc/slabinfo -and aims to be command line and output compatible with it. +\fBpcp-slabinfo\fP collects information from \fI/proc/slabinfo\fP and aims to be command-line and output compatible with it. + .SH PCP ENVIRONMENT -Environment variables with the prefix \fBPCP_\fP are used to parameterize -the file and directory names used by PCP. -On each installation, the -file \fI/etc/pcp.conf\fP contains the local values for these variables. -The \fB$PCP_CONF\fP variable may be used to specify an alternative -configuration file, as described in \fBpcp.conf\fP(5). -.PP +Environment variables with the prefix \fBPCP_\fP are used to parameterize the file and directory names used by PCP. On each installation, the file \fI/etc/pcp.conf\fP contains the local values for these variables. The \fB$PCP_CONF\fP variable may be used to specify an alternative configuration file, as described in \fBpcp.conf\fP(5). + For environment variables affecting PCP tools, see \fBpmGetOptions\fP(3). -.SH SEE ALSO -.BR PCPIntro (1), -.BR pcp (1), -.BR pmParseInterval (3) -and -.BR environ (7). +.SH SEE ALSO +.BR PCPIntro(1), +.BR pcp(1), +.BR pmParseInterval(3), +.BR environ(7). diff --git a/src/pcp/slabinfo/pcp-slabinfo.py b/src/pcp/slabinfo/pcp-slabinfo.py index bb9454058f..e83410f151 100644 --- a/src/pcp/slabinfo/pcp-slabinfo.py +++ b/src/pcp/slabinfo/pcp-slabinfo.py @@ -189,7 +189,7 @@ def __init__(self): opts.context=mngr.type missing = mngr.checkMissingMetrics(ALL_METRICS) if missing is not None: - sys.stderr.write(F"Error:Metric is {missing} missing\n") + sys.stderr.write("Error:some metrics are unavailable",missing) sys.exit(1) mngr["slabinfo"] = SLABSTAT_METRICS mngr["sysinfo"] = SYS_MECTRICS @@ -198,9 +198,11 @@ def __init__(self): sts = mngr.run() sys.exit(sts) except pmapi.pmErr as error: - sys.stderr.write(F"{error.progname()} {error.message()}") + sys.stderr.write('%s\n' % (error.message())) except pmapi.pmUsageErr as usage: usage.message() sys.exit(1) + except IOError: + signal.signal(signal.SIGPIPE, signal.SIG_DFL) except KeyboardInterrupt: pass