tools/kvm_stat: simplify line print logic
authorStefan Raspl <raspl@linux.vnet.ibm.com>
Wed, 7 Jun 2017 19:08:29 +0000 (21:08 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 8 Jun 2017 16:14:36 +0000 (18:14 +0200)
commit5a7d11f8dc59ddb36e89dca42a2526ea25914def
treedf27e5b6d919db0bff27a4fb980be1b476624233
parent2da9d4aaa7348fc13374d7398c9c7027b0a9e2cb
tools/kvm_stat: simplify line print logic

Simplify line print logic for header and data lines in interactive mode
as previously suggested by Radim.
While at it, add a space between the first two columns to avoid the
total bleeding into the event name.
Furthermore, for column 'Current', differentiate between no events being
reported (empty 'Current' column) vs the case where events were reported
but the average was rounded down to zero ('0' in 'Current column), for
the folks who appreciate the difference.
Finally: Only skip events which were not reported at all yet, instead of
events that don't have a value in the current interval.
Considered using constants for the field widths in the format strings.
However, that would make things a bit more complicated, and considering
that there are only two places where output happens, I figured it isn't
worth the trouble.

Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/kvm/kvm_stat/kvm_stat