pcp
[Top] [All Lists]

[patch] fix the pmiostat output samples's count issue

To: "pcp@xxxxxxxxxxx" <pcp@xxxxxxxxxxx>
Subject: [patch] fix the pmiostat output samples's count issue
From: "Wu, Liming" <wulm.fnst@xxxxxxxxxxxxxx>
Date: Tue, 17 May 2016 08:18:38 +0000
Accept-language: zh-CN, en-US
Delivered-to: pcp@xxxxxxxxxxx
Thread-index: AdGwEHgPgoVlqB0rQ5eS4sO5P/LTyA==
Thread-topic: [patch] fix the pmiostat output samples's count issue
Hi

There are only 2 samples when you specified  3  as follows. 
# pmiostat -s 3
# Device      rrqm/s  wrqm/s     r/s    w/s    rkB/s    wkB/s avgrq-sz avgqu-sz 
  await r_await w_await   %util
sda             0.00    0.00    0.00   0.00     0.00     0.00    0.000    0.000 
   0.00    0.00    0.00    0.00
sda             0.00    0.00    0.00   0.00     0.00     0.00    0.000    0.000 
   0.00    0.00    0.00    0.00

src/python/pcp/pmcc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 
diff --git a/src/python/pcp/pmcc.py b/src/python/pcp/pmcc.py
index 0117b26..e041860 100644
--- a/src/python/pcp/pmcc.py
+++ b/src/python/pcp/pmcc.py
@@ -619,9 +619,9 @@ class MetricGroupManager(dict, MetricCache):
             self.fetch()
             while True:
                 self._counter += 1
-                if samples == 0 or self._counter <= samples:
+                if samples == 0 or self._counter <= samples + 1:
                     self._printer.report(self)
-                if self._counter == samples:
+                if self._counter == samples + 1:
                     break
                 timer.sleep()
                 self.fetch()

--------------------------------------------------
wuliming
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST) No. 6 Wenzhu Road, 
Nanjing, 210012, China
TEL:+86-25-86630566-8530
FUJITSU INTERNAL:7998-8530
FAX:+86+25-83317685
EMail:wulm.fnst@xxxxxxxxxxxxxx
--------------------------------------------------



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