Bug 1922768 - dstat count is one off
Summary: dstat count is one off
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcp
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nathan Scott
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-31 14:27 UTC by Georg Sauthoff
Modified: 2021-02-24 20:44 UTC (History)
3 users (show)

Fixed In Version: pcp-5.2.5-2.fc33 pcp-5.2.5-2.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-24 20:39:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Georg Sauthoff 2021-01-31 14:27:00 UTC
Description of problem:
When invoking dstat with an explicit count of n it actually just prints n-1 updates.


Version-Release number of selected component (if applicable):
pcp-system-tools-5.2.3-1.fc33.x86_64

How reproducible:
always

Steps to Reproduce:
1. dstat 1 3
2. dstat 1 1
3.

Actual results:
You did not select any stats, using -cdngy by default.
----total-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw 
 15   4  80   0   0|   0   811k|  25k 1119B|   0     0 |3721  4738 
 18   5  77   0   0|   0     0 |  27k  980B|   0     0 |3789  4659

You did not select any stats, using -cdngy by default.
----total-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw 



Expected results:
Three updates, in total - i.e. something like this:

You did not select any stats, using -cdngy by default.
----total-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw 
 15   4  80   0   0|   0   811k|  25k 1119B|   0     0 |3721  4738 
 18   5  77   0   0|   0     0 |  27k  980B|   0     0 |3789  4659
 16   5  77   0   0|   0     0 |  27k 1980B|   0     0 |3780  4653

Followed by one update:

You did not select any stats, using -cdngy by default.
----total-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read  writ| recv  send|  in   out | int   csw 
 17   5  77   0   0|   0     0 |  24k  909B|   0     0 |3937  4912


Additional info:

The result of the second invocation seems to be a regression - cf. #1449687

Note that the current dstat behavior is also inconsistent with similar tools such as vmstat.

Comment 1 Nathan Scott 2021-01-31 22:56:08 UTC
Thanks Georg!

This patch seems to resolve the issue, lightly tested only so far:

diff --git a/src/pcp/dstat/pcp-dstat.py b/src/pcp/dstat/pcp-dstat.py
index b8d786bd5..e5c20fba2 100755
--- a/src/pcp/dstat/pcp-dstat.py
+++ b/src/pcp/dstat/pcp-dstat.py
@@ -705,7 +705,7 @@ class DstatTool(object):
                 sys.exit(1)
         if len(operands) > 1:
             try:
-                self.samples = int(operands[1])
+                self.samples = int(operands[1]) + 1
             except:
                 sys.stderr.write("Invalid sample count '%s'\n" % operands[1])
                 sys.exit(1)


I'll do some more testing (haven't checked archives yet, nor updated the regression tests) and get this fixed in pcp-5.2.4.

cheers.

Comment 2 Fedora Update System 2021-02-15 00:05:58 UTC
FEDORA-2021-c64d2658a0 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-c64d2658a0

Comment 3 Fedora Update System 2021-02-15 00:06:23 UTC
FEDORA-2021-4e2b6f6f82 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-4e2b6f6f82

Comment 4 Fedora Update System 2021-02-15 01:14:31 UTC
FEDORA-2021-c64d2658a0 has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-c64d2658a0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-c64d2658a0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2021-02-16 01:18:23 UTC
FEDORA-2021-4e2b6f6f82 has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-4e2b6f6f82`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-4e2b6f6f82

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2021-02-24 20:39:54 UTC
FEDORA-2021-c64d2658a0 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2021-02-24 20:44:25 UTC
FEDORA-2021-4e2b6f6f82 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.