~hyman <hy...@git.sr.ht> wrote: > From: Hyman Huang(黄勇) <yong.hu...@smartx.com> > > Extend query-migrate to provide throttle time and estimated > ring full time with dirty-limit capability enabled, through which > we can observe if dirty limit take effect during live migration. > > Signed-off-by: Hyman Huang(黄勇) <yong.hu...@smartx.com> > Signed-off-by: Markus Armbruster <arm...@redhat.com>
Nit for the resent. > +int64_t dirtylimit_throttle_time_per_round(void); > +int64_t dirtylimit_ring_full_time(void); int64? > @@ -267,7 +278,9 @@ > '*postcopy-blocktime' : 'uint32', > '*postcopy-vcpu-blocktime': ['uint32'], > '*compression': 'CompressionStats', > - '*socket-address': ['SocketAddress'] } } > + '*socket-address': ['SocketAddress'], > + '*dirty-limit-throttle-time-per-round': 'int64', > + '*dirty-limit-ring-full-time': 'int64'} } int64 > +/* Return the max throttle time of each virtual CPU */ > +int64_t dirtylimit_throttle_time_per_round(void) > +{ > + CPUState *cpu; > + int64_t max = 0; > + > + CPU_FOREACH(cpu) { > + if (cpu->throttle_us_per_full > max) { > + max = cpu->throttle_us_per_full; > + } > + } > + > + return max; > +} s/int64_t/uint64_t/? > + > +/* > + * Estimate average dirty ring full time of each virtaul CPU. > + * Return -1 if guest doesn't dirty memory. > + */ > +int64_t dirtylimit_ring_full_time(void) > +{ > + CPUState *cpu; > + uint64_t curr_rate = 0; > + int nvcpus = 0; > + > + CPU_FOREACH(cpu) { > + if (cpu->running) { > + nvcpus++; > + curr_rate += vcpu_dirty_rate_get(cpu->cpu_index); > + } > + } > + > + if (!curr_rate || !nvcpus) { > + return -1; What does -1 brings up that 0 don't? i.e. returning 0 here would mean that nothing has been dirtied or that we don't have any vcpus running, right? Later, Juan.