Skip to content

Commit

Permalink
Adding -x noidle flag to pmiostat.
Browse files Browse the repository at this point in the history
The -x noidle flag will skip idle devices in pmiostat output.
  • Loading branch information
Nikhil Kshirsagar committed Apr 22, 2016
1 parent 811113b commit fdfedc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/pcp/iostat/pcp-iostat.1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[\f3\-Z\f1 \f2timezone\f1 \f3--timezone=\f2TZ\f1]
[\f3\-z\f1 \f3--hostzone\f1]
[\f3\-?\f1 \f3--help\f1]
[\f3\-x\f1 [dm][,t][,h]\f1]
[\f3\-x\f1 [dm][,t][,h][,noidle]\f1]
.SH DESCRIPTION
.de EX
.in +0.5i
Expand Down Expand Up @@ -194,7 +194,9 @@ Specifies a comma separated list of one or more extended reporting options as fo
.br
\f3t\fP - prefix every line in the report with a timestamp in \f2ctime\fP(3) format,
.br
\f3H\fP - omit the heading, which is otherwise reported every 24 samples.
\f3H\fP - omit the heading, which is otherwise reported every 24 samples,
.br
\f3noidle\fP - Do not display statistics for idle devices.
.SH REPORT
The columns in the
.B pcp-iostat
Expand Down
10 changes: 8 additions & 2 deletions src/pcp/iostat/pcp-iostat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env pmpython
#
# Copyright (C) 2014-2016 Red Hat.
#
# This program is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -208,6 +207,9 @@ def report(self, manager):
'?',precision+6, '?',headfmtavgspace, '?',headfmtquspace, '?', precision+5, '?',awaitspace, '?',\
awaitspace, '?',utilspace, '?'))
else:
if "noidle" in IostatOptions.xflag:
if rrqm == 0 and wrqm == 0 and r == 0 and w == 0 :
continue
print(valfmt % (timestamp, device,rrqmspace, precision, rrqm,wrqmspace,precision, wrqm,precision+5,precision,\
r,precision+4,precision, w,precision+6,precision, rkb,precision+6,precision, wkb, avgrqszspace,precision+1 ,avgrqsz,\
avgrqszspace,precision+1, avgqsz,precision+5,precision, await,awaitspace,precision, r_await,awaitspace,precision,\
Expand All @@ -217,6 +219,9 @@ def report(self, manager):
print(headfmt % (device,rrqmspace, '?',wrqmspace, '?',precision+5, '?',precision+4, '?',precision+6, '?',precision+6,\
'?',headfmtavgspace, '?',headfmtquspace, '?', precision+5, '?',awaitspace, '?',awaitspace, '?',utilspace, '?'))
else:
if "noidle" in IostatOptions.xflag:
if rrqm == 0 and wrqm == 0 and r == 0 and w == 0 :
continue
print(valfmt % (device,rrqmspace, precision, rrqm,wrqmspace,precision, wrqm,precision+5,precision, r,precision+4,\
precision, w,precision+6,precision, rkb,precision+6,precision, wkb,\
avgrqszspace,precision+1 ,avgrqsz,avgrqszspace,precision+1, avgqsz,precision+5,precision, await,awaitspace,precision,\
Expand Down Expand Up @@ -270,10 +275,11 @@ def __init__(self):
self.pmSetLongOptionHostZone()
self.pmSetLongOptionHelp()
self.pmSetLongOptionHeader("Extended options")
self.pmSetLongOption("", 1, 'x', "LIST", "comma separated extended options: [[dm],[t],[h]]")
self.pmSetLongOption("", 1, 'x', "LIST", "comma separated extended options: [[dm],[t],[h],[noidle]]")
self.pmSetLongOptionText("\t\tdm\tshow device-mapper statistics (default is sd devices)")
self.pmSetLongOptionText("\t\tt\tprecede every line with a timestamp in ctime format");
self.pmSetLongOptionText("\t\th\tsuppress headings");
self.pmSetLongOptionText("\t\tnoidle\tdo not display idle devices");

if __name__ == '__main__':
try:
Expand Down

0 comments on commit fdfedc3

Please sign in to comment.