|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xenpm: Add option to report average CPU frequency
commit aa037dc9d3e09850f8a0e4ba9fba8e487f8a64cc
Author: Malcolm Crossley <malcolm.crossley@xxxxxxxxxx>
AuthorDate: Tue Jan 19 11:27:56 2016 +0000
Commit: Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Jan 19 16:16:08 2016 +0000
xenpm: Add option to report average CPU frequency
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 <malcolm.crossley@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
tools/misc/xenpm.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index 08f2242..a2edee5 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
<cpuid> or all\n"
" get-cpufreq-states [cpuid] list cpu freq info of CPU
<cpuid> or all\n"
+ " get-cpufreq-average [cpuid] average cpu frequency since
last invocation\n"
+ " for CPU <cpuid> or all\n"
" get-cpufreq-para [cpuid] list cpu freq parameter of
CPU <cpuid> or all\n"
" set-scaling-maxfreq [cpuid] <HZ> set max cpu frequency <HZ>
on CPU <cpuid>\n"
" or all CPUs\n"
@@ -343,6 +345,40 @@ void pxstat_func(int argc, char *argv[])
show_pxstat_by_cpuid(xc_handle, cpuid);
}
+static int show_cpufreq_by_cpuid(xc_interface *xc_handle, int cpuid)
+{
+ int ret = 0;
+ int average_cpufreq;
+
+ ret = get_avgfreq_by_cpuid(xc_handle, cpuid, &average_cpufreq);
+ if ( ret )
+ return ret;
+
+ printf("cpu id : %d\n", cpuid);
+ printf("average cpu frequency: %d\n", average_cpufreq);
+ printf("\n");
+ return 0;
+}
+
+void cpufreq_func(int argc, char *argv[])
+{
+ int cpuid = -1;
+
+ if ( argc > 0 )
+ parse_cpuid(argv[0], &cpuid);
+
+ if ( cpuid < 0 )
+ {
+ /* show average frequency on all cpus */
+ int i;
+ for ( i = 0; i < max_cpu_nr; i++ )
+ if ( show_cpufreq_by_cpuid(xc_handle, i) == -ENODEV )
+ break;
+ }
+ else
+ show_cpufreq_by_cpuid(xc_handle, cpuid);
+}
+
static uint64_t usec_start, usec_end;
static struct xc_cx_stat *cxstat, *cxstat_start, *cxstat_end;
static struct xc_px_stat *pxstat, *pxstat_start, *pxstat_end;
@@ -1129,6 +1165,7 @@ struct {
{ "help", help_func },
{ "get-cpuidle-states", cxstat_func },
{ "get-cpufreq-states", pxstat_func },
+ { "get-cpufreq-average", cpufreq_func },
{ "start", start_gather_func },
{ "get-cpufreq-para", cpufreq_para_func },
{ "set-scaling-maxfreq", scaling_max_freq_func },
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |