From: Paolo Bonzini Subject: Re: [PATCH 07/17] tools/kvm_stat: reduce perceived idle time on filter updates Date: Thu, 9 Mar 2017 17:54:40 +0100 Message-ID: <32813101-e957-c5c9-aa2c-5283c9e627e3@redhat.com> References: <20170220154211.11882-1-raspl@linux.vnet.ibm.com> <20170220154211.11882-8-raspl@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: rkrcmar@redhat.com, frankja@linux.vnet.ibm.com To: Stefan Raspl , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33986 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932452AbdCIQys (ORCPT ); Thu, 9 Mar 2017 11:54:48 -0500 In-Reply-To: <20170220154211.11882-8-raspl@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 20/02/2017 16:42, Stefan Raspl wrote: > Whenever a user adds a filter, we > * redraw the header immediately for a snappy response > * print a message indicating to the user that we're busy while the > noticeable delay induced by updating all of the stats objects takes place > * update the statistics ASAP (i.e. after 0.25s instead of 3s) to be > consistent with behavior on startup > To do so, we split the Tui's refresh() method to allow for drawing header > and stats separately, and trigger a header refresh whenever we are about > to do something that takes a while - like updating filters. > > Signed-off-by: Stefan Raspl > --- > tools/kvm/kvm_stat/kvm_stat | 48 ++++++++++++++++++++++++++++----------------- > 1 file changed, 30 insertions(+), 18 deletions(-) > > diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat > index e0503c8..eeb5fe5 100755 > --- a/tools/kvm/kvm_stat/kvm_stat > +++ b/tools/kvm/kvm_stat/kvm_stat > @@ -800,6 +800,8 @@ class Stats(object): > > LABEL_WIDTH = 40 > NUMBER_WIDTH = 10 > +DELAY_INITIAL = 0.25 > +DELAY_REGULAR = 3. Same here, the float constant isn't strictly necessary and the trailing dot is somewhat distracting. Nothing to complain about the change, which is a nice touch. Paolo > > class Tui(object):