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 <raspl@xxxxxxxxxxxxxxxxxx> > --- > 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):