pcp
[Top] [All Lists]

Re: [pcp] pmrep: tweak unit string

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] pmrep: tweak unit string
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 15 Jun 2016 21:35:02 +0300
Cc: pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <1171690373.54525157.1465864675562.JavaMail.zimbra@xxxxxxxxxx>
Organization: Red Hat
References: <575EBA29.90508@xxxxxxxxxx> <1171690373.54525157.1465864675562.JavaMail.zimbra@xxxxxxxxxx>
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
Hi,

On 2016-06-14 03:37, Nathan Scott wrote:
> ----- Original Message -----
>>
>> I noticed that libpcp and most PCP clients report count per second as
>> "count / sec" but pmrep(1) uses "count/s" (for non-raw counters).
> 
> Yeah, its pmUnitsStr_r(3) in libpcp producing this form IIRC.
> 
>> What do you think about the patch below, could we unify the output? I
>> perhaps slightly prefer the more compact output but in the end it might
> 
> I tend to prefer the compact output too for pmrep, which has strategies
> for producing short column headings that other tools don't employ - so I
> think its fine as-is.  But that's just me...
> 
>> be better to be consistent all across the board. Alternatively, we
>> could of course make pmrep(1) to always use "/s". (If yes, this would
>> require regenerating/tweaking for QA test case outputs.)
> 
> Up to you - if you do choose a new strategy please send through code and
> test updates together, makes life easier at this end.  Thanks!

Ok, let's switch to the compact form, the change is trivial and it
covers all the existing metrics (in fact the millisec case is only
needed for a metric from the sample PMDA). Change to this direction
doesn't require QA updates.

---
 src/pmrep/pmrep.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index b330ca6..d73dda2 100755
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -739,7 +739,8 @@ class PMReporter(object):
                             label = "util"
                     self.metrics[metric][2] = (label, unitstr, mult)
                 else:
-                    self.metrics[metric][2] = (unitstr, unitstr, 1)
+                    label = unitstr.replace(" / sec", "/s").replace(" / 
millisec", "/ms")
+                    self.metrics[metric][2] = (label, unitstr, 1)
             except pmapi.pmErr as error:
                 sys.stderr.write("%s: %s.\n" % (str(error), 
self.metrics[metric][2]))
                 sys.exit(1)

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>