pcp
[Top] [All Lists]

pmrep: avoid ambiguous config option

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: pmrep: avoid ambiguous config option
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Sun, 13 Dec 2015 17:46:09 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: myllynen@xxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
Hi,

the Fetchgroup API came with the idea to allow rates also for
non-counter metrics. In case we start using pmfg or such in
pmrep then "r" would become ambiguous (raw vs rate). Let's
avoid this before it becomes an issue.

Note that pmfg has some needless (at least on pmrep level)
limitations wrt unit/scale being ignored when using raw/rate.
For example, on a system with few TBs of memory one might
want to see memory usage change in MB/s when launching up a
huge application.

While there's zero code to implement this at the moment
let's adjust the wording a bit so that a careful user
can be prepared for that possibility already today.

---
 src/pmrep/TODO         |  3 ++-
 src/pmrep/pmrep.1      | 15 ++++++++-------
 src/pmrep/pmrep.conf   |  2 +-
 src/pmrep/pmrep.conf.5 |  6 +++---
 src/pmrep/pmrep.py     |  2 +-
 5 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/pmrep/TODO b/src/pmrep/TODO
index cc3d91f..c5bfa4c 100644
--- a/src/pmrep/TODO
+++ b/src/pmrep/TODO
@@ -3,11 +3,12 @@
 -  allow defining instances to display [-i]
 -  opt to write cols per row with stdout output [-k]
 -  -Q/-B/-Y to override per-metric settings unit/scale
--  maybe adjust unit/scale handling to ~match fetchgroup
 -  shorten unit display count / sec -> count/s -> c/s if needed
 -  opt to output in short format (see pmdumptext -F / pmNumberStr) [-m/-M]
 -  opt to support pmdumptext -X like output (or shorten inst names if needed)
 -  bash/zsh completion with short help (allow description for sets?)
+-  support rate display also for non-cumulative counters
+-  support displaying raw/rate as per given unit
 -  containers support
 -  verify CSV format
 -  add JSON output support
diff --git a/src/pmrep/pmrep.1 b/src/pmrep/pmrep.1
index 2165136..31ac117 100644
--- a/src/pmrep/pmrep.1
+++ b/src/pmrep/pmrep.1
@@ -150,17 +150,18 @@ The optional
 definition is currently unimplemented.
 An optional
 .I unit/scale
-is applicable for dimension-comptatible, non-string, non-raw metrics.
+is applicable for dimension-comptatible, non-string, and (currently)
+non-raw metrics.
 (See below for supported
 .I unit/scale
 specifications.)
 By default, cumulative counter metrics are converted to rates.
 If the optional
 .I raw
-field is
-.B r
-then the rate conversion is disabled and raw values are reported
-instead.
+field is set to
+.B raw
+then this rate conversion is disabled, unit/scale specification is
+(currently) ignored and raw values are reported instead.
 Finally, for supporting output targets (currently:
 .IR stdout )
 a numeric
@@ -175,7 +176,7 @@ The following
 requests the metric
 .B kernel.all.sysfork
 to be reported under the label
-.BR fork/s ,
+.BR forks ,
 converting to the default rate count/s in an
 .B 8
 wide column.
@@ -186,7 +187,7 @@ are optional, they must always be provided in the order 
specified above.
 .in 1.5i
 .ft CW
 .nf
-kernel.all.sysfork,fork/s,,,,8
+kernel.all.sysfork,forks,,,,8
 .fi
 .ft R
 .in
diff --git a/src/pmrep/pmrep.conf b/src/pmrep/pmrep.conf
index d9febc0..6103475 100644
--- a/src/pmrep/pmrep.conf
+++ b/src/pmrep/pmrep.conf
@@ -30,7 +30,7 @@
 ##includedir =
 
 # Compact metric specifications are of form:
-#pcp.metric.name = label,instance(s),unit/scale,r-for-raw,column-width
+#pcp.metric.name = label,instance(s),unit/scale,raw,column-width
 
 # Global metrics are displayed as part of any set (unless disabled with -G)
 [global]
diff --git a/src/pmrep/pmrep.conf.5 b/src/pmrep/pmrep.conf.5
index 3a0b936..9b8dce4 100644
--- a/src/pmrep/pmrep.conf.5
+++ b/src/pmrep/pmrep.conf.5
@@ -386,13 +386,13 @@ This specifier is currently recognized but not 
implemented.
 .TP 2
 .I unit
 Defines the unit/scale conversion for the metric. Needs to be
-dimension-comptatible and is used with non-string, non-raw metrics.
+dimension-comptatible and is used with non-string and (currently)
+non-raw metrics.
 For allowed values, see
 .BR pmrep (3).
 .TP 2
 .I raw
-If set to \fByes\fR or \fBr\fR rate conversion for the metric will be
-disabled.
+If set to \fByes\fR rate conversion for the metric will be disabled.
 .TP 2
 .I width
 Defines the width of the output column for the metric.
diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index 2b2de05..f60ef6c 100644
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -670,7 +670,7 @@ class PMReporter(object):
                 self.metrics[metric][0] = name[:-2] + m
 
             # Rawness
-            if self.metrics[metric][3] == 'r' or \
+            if self.metrics[metric][3] == 'raw' or \
                self.metrics[metric][3] == 'yes' or self.raw == 1:
                 self.metrics[metric][3] = 1
             else:

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>
  • pmrep: avoid ambiguous config option, Marko Myllynen <=