On Fri, 2019-07-26 at 13:37 +0300, Andrii Anisov wrote: > diff --git a/xen/common/schedule.c b/xen/common/schedule.c > index 0a38d4a..9e8805d 100644 > --- a/xen/common/schedule.c > +++ b/xen/common/schedule.c > @@ -217,6 +217,28 @@ uint64_t get_cpu_idle_time(unsigned int cpu) > return state.time[RUNSTATE_blocked]; > } > > +uint64_t get_cpu_guest_time(unsigned int cpu) > +{ > + struct vcpu_runstate_info state = { 0 }; > + struct vcpu *v = idle_vcpu[cpu]; > + > + if ( cpu_online(cpu) && v ) > + vcpu_runstate_get(v, &state); > + > + return state.time[RUNSTATE_runnable]; > +} > + Yep, I think being able to know time spent running guests could be useful. > +uint64_t get_cpu_hyp_time(unsigned int cpu) > +{ > + struct vcpu_runstate_info state = { 0 }; > + struct vcpu *v = idle_vcpu[cpu]; > + > + if ( cpu_online(cpu) && v ) > + vcpu_runstate_get(v, &state); > + > + return state.time[RUNSTATE_running]; > +} > + > I confirm what I said about patch 1: idle time being the time idle_vcpu spent in RUNSTATE_blocked, and hypervisor time being the time idle_vcpu spent in RUNSTATE_running sounds quite confusing to me. Regards -- Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <> (Raistlin Majere)