From mboxrd@z Thu Jan 1 00:00:00 1970 From: Malcolm Crossley Subject: Re: [PATCH] xenpm: Add option to report average CPU frequency Date: Tue, 19 Jan 2016 11:10:26 +0000 Message-ID: <569E19A2.1020108@citrix.com> References: <1453200631-11818-1-git-send-email-malcolm.crossley@citrix.com> <1453201574.29930.16.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1453201574.29930.16.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com, wei.liu2@citrix.com Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 19/01/16 11:06, Ian Campbell wrote: > On Tue, 2016-01-19 at 10:50 +0000, Malcolm Crossley wrote: >> The average is calculated over the period of time from the last >> xenpm report of the average CPU frequency. >> >> Reporting the average CPU frequency helps confirm the level of turbo >> boost being achieved per CPU. >> >> Signed-off-by: Malcolm Crossley >> --- >> tools/misc/xenpm.c | 42 +++++++++++++++++++++++++++++++++++++++++- >> 1 file changed, 41 insertions(+), 1 deletion(-) >> >> diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c >> index 08f2242..40cdd55 100644 >> --- a/tools/misc/xenpm.c >> +++ b/tools/misc/xenpm.c >> @@ -45,6 +45,8 @@ void show_help(void) >> "xenpm command list:\n\n" >> " get-cpuidle-states [cpuid] list cpu idle info of >> CPU or all\n" >> " get-cpufreq-states [cpuid] list cpu freq info of >> CPU or all\n" >> + " get-cpufreq-average [cpuid] average cpu frequency >> since last invocation\n" >> + " for CPU or >> all\n" >> " get-cpufreq-para [cpuid] list cpu freq >> parameter of CPU or all\n" >> " set-scaling-maxfreq [cpuid] set max cpu frequency >> on CPU \n" >> " or all CPUs\n" >> @@ -296,6 +298,9 @@ static int get_pxstat_by_cpuid(xc_interface >> *xc_handle, int cpuid, struct xc_px_ >> return ret; >> } >> >> + >> +static int *avgfreq; > > Do we need the global array of them all when each element is used exactly > once entirely within show_cpufreq_by_cpuid in this mode? > The global array was already defined for when xenpm is used as a cpu frequency control daemon, I just moved it so that the new functions could use the variable. Do you want me to spin the patch using a local int variable instead? Malcolm