From mboxrd@z Thu Jan 1 00:00:00 1970 From: Janosch Frank Subject: Re: [PATCH 16/17] tools/kvm_stat: add interactive command 'r' Date: Fri, 10 Mar 2017 12:37:19 +0100 Message-ID: References: <20170220154211.11882-1-raspl@linux.vnet.ibm.com> <20170220154211.11882-17-raspl@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xs20n2b2O7FECcl9b2NjSFpwkq6Q3RTMr" Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: Stefan Raspl , kvm@vger.kernel.org Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33378 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933626AbdCJLhd (ORCPT ); Fri, 10 Mar 2017 06:37:33 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2ABSdnO114571 for ; Fri, 10 Mar 2017 06:37:32 -0500 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 293c13bsj1-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Mar 2017 06:37:32 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Mar 2017 11:37:29 -0000 In-Reply-To: <20170220154211.11882-17-raspl@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xs20n2b2O7FECcl9b2NjSFpwkq6Q3RTMr Content-Type: multipart/mixed; boundary="ri6cjoWOBhC5e0MfpiHu0K1IXus810sOE"; protected-headers="v1" From: Janosch Frank To: Stefan Raspl , kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com Message-ID: Subject: Re: [PATCH 16/17] tools/kvm_stat: add interactive command 'r' References: <20170220154211.11882-1-raspl@linux.vnet.ibm.com> <20170220154211.11882-17-raspl@linux.vnet.ibm.com> In-Reply-To: <20170220154211.11882-17-raspl@linux.vnet.ibm.com> --ri6cjoWOBhC5e0MfpiHu0K1IXus810sOE Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 20.02.2017 16:42, Stefan Raspl wrote: > Provide an interactive command to reset the tracepoint statistics. > Requires some extra work for debugfs, as the counters cannot be reset. > On the up side, offers us the opportunity to have debugfs values reset ^ add "this" > on startup and whenever a filter is modified, becoming consistent with > the tracepoint provider. As a bonus, 'kvmstat -dt' will now provide > useful output, instead of mixing values in totally different orders of > magnitude. > Furthermore, we avoid unnecessary resets when any of the filters is > "changed" interactively to the previous value. Acked-by: Janosch Frank >=20 > Signed-off-by: Stefan Raspl > --- > tools/kvm/kvm_stat/kvm_stat | 66 +++++++++++++++++++++++++++++++--= -------- > tools/kvm/kvm_stat/kvm_stat.txt | 2 ++ > 2 files changed, 53 insertions(+), 15 deletions(-) >=20 > diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat > index e0f28e1..f9f653a 100755 > --- a/tools/kvm/kvm_stat/kvm_stat > +++ b/tools/kvm/kvm_stat/kvm_stat > @@ -715,15 +715,23 @@ class TracepointProvider(object): > ret[name] +=3D val > return ret >=20 > + def reset(self): > + """Reset all field counters""" > + for group in self.group_leaders: > + for event in group.events: > + event.reset() > + >=20 > class DebugfsProvider(object): > """Provides data from the files that KVM creates in the kvm debugf= s > folder.""" > def __init__(self): > self._fields =3D self.get_available_fields() > + self._baseline =3D {} > self._pid =3D 0 > self.do_read =3D True > self.paths =3D [] > + self.reset() >=20 > def get_available_fields(self): > """"Returns a list of available fields. > @@ -740,6 +748,7 @@ class DebugfsProvider(object): > @fields.setter > def fields(self, fields): > self._fields =3D fields > + self.reset() >=20 > @property > def pid(self): > @@ -757,10 +766,11 @@ class DebugfsProvider(object): > self.paths =3D filter(lambda x: "{}-".format(pid) in x, vm= s) >=20 > else: > - self.paths =3D [''] > + self.paths =3D [] This is more a cleanup than new code, isn't it? [...] > @@ -1188,7 +1224,7 @@ Interactive Commands: > g filter by guest name > p filter by PID > q quit > - x toggle reporting of stats for individual child trace events > + r reset stats > Press any other key to refresh statistics immediately. > """ This is inconsistent to the part below. > diff --git a/tools/kvm/kvm_stat/kvm_stat.txt b/tools/kvm/kvm_stat/kvm_s= tat.txt > index c3ab6a2..109431b 100644 > --- a/tools/kvm/kvm_stat/kvm_stat.txt > +++ b/tools/kvm/kvm_stat/kvm_stat.txt > @@ -39,6 +39,8 @@ INTERACTIVE COMMANDS >=20 > *q*:: quit >=20 > +*r*:: reset stats > + > *x*:: toggle reporting of stats for child trace events >=20 > Press any other key to refresh statistics immediately. >=20 --ri6cjoWOBhC5e0MfpiHu0K1IXus810sOE-- --xs20n2b2O7FECcl9b2NjSFpwkq6Q3RTMr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYwo/vAAoJEBcO/8Q8ZEV59OgP/Av4ozTfVQtPzXjSzUbikXbh XrJS4y63T/EJMj/kTL1gGpl99QBkFHOAxtPWox9ENnFQ3S39cZsO1R8tuaXQsIJV zlfrOBiqXJbtQeZhDXWTHq8u61y0LbqStVFXqH8Wsdw8VfE7SORY/QcTttSuCaCE N+OPU51ZK3tggc5PxaWu611bbYB9Sqs0qwNpA2+tqJ75MDSLgwyC7R0+Fyr3Dg3e Ukviqv/sv/brFLesGes0n8ZC5PzPbfeyZZ+yxBHxCDrvjEcMk0AnffUJS+dQAgr8 aSHFndud+Zr6tapainVijPPrK+zrIzzE0S3R0LE76I2SzMCfVgE/GMlbOA2DOnEQ ZNew1fe7ljDSyEqQ6Quggp1Tg5KuUVxB+HUsXqcuhJzesx+/idagOoJx8z1+py8+ Mxbw1MR5qm11dtwaWM3aQClfK70nj1GopYzBwstsbpYg8OggJKjOgMkaxL86hbvQ 7ByCmcMJFya1WavmchzUlGW6+Z7EVOgXkdGK+vtGvg6cfSCct4Wgu9DXXu8X3vm4 3YdCmnHDsSNWi8OJwGOlCZ9j0vRanHp4P2kBnC6PtunaqCE9EtLqZZOgfhI7jttJ lvgGGjt+dB/8yPmMNtVHd+sWDq5mM90NYTX7KL6JKvHzfFzITjYBcokkKkpMrGXJ F8+X80aMmGVQQroBlPAm =Xu/a -----END PGP SIGNATURE----- --xs20n2b2O7FECcl9b2NjSFpwkq6Q3RTMr--