Skip to content

Commit

Permalink
pcp-slabinfo: review comment rework
Browse files Browse the repository at this point in the history
-Compressed the qa archive to save space
-Rectified the mandoc issue related to pcp-slabinfo man page
-Fixed error message for missing metric

Signed-off-by: sagar sagar <[email protected]>
  • Loading branch information
orasagar committed Aug 2, 2023
1 parent a81fbef commit 90bbf99
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 87 deletions.
2 changes: 1 addition & 1 deletion qa/1989
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@@ -0,0 +1,39 @@
#!/bin/sh
# PCP QA Test No. 1989
# Exercise various pcp-slabinfo(1) command options.
Expand All @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions qa/archives/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
13 changes: 11 additions & 2 deletions qa/archives/mk.slabinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file removed qa/archives/pcp-slabinfo.0
Binary file not shown.
Binary file added qa/archives/pcp-slabinfo.0.xz
Binary file not shown.
Binary file removed qa/archives/pcp-slabinfo.index
Binary file not shown.
Binary file added qa/archives/pcp-slabinfo.index.xz
Binary file not shown.
Binary file removed qa/archives/pcp-slabinfo.meta
Binary file not shown.
Binary file added qa/archives/pcp-slabinfo.meta.xz
Binary file not shown.
128 changes: 48 additions & 80 deletions src/pcp/slabinfo/pcp-slabinfo.1
Original file line number Diff line number Diff line change
@@ -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.
.\"
Expand All @@ -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).
6 changes: 4 additions & 2 deletions src/pcp/slabinfo/pcp-slabinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 90bbf99

Please sign in to comment.