diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-03-20 08:48:57 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-03-20 08:48:57 +0000 |
commit | 037d1b3c896025d2ef91d4fef57e49d1d375f391 (patch) | |
tree | 6eb62038e7885d5e7af633b3e80e91e425a9bb98 /tools/libxc/xc_pm.c | |
parent | 1d79561c4160abd7de9d754892088351f33e79c5 (diff) | |
download | xen-037d1b3c896025d2ef91d4fef57e49d1d375f391.tar.gz xen-037d1b3c896025d2ef91d4fef57e49d1d375f391.tar.bz2 xen-037d1b3c896025d2ef91d4fef57e49d1d375f391.zip |
Deliver cpufreq actual average freq to libxc interface
Calculate cpu actual average freq according to aperf and mperf MSR and
then deliver to libxc interface
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Diffstat (limited to 'tools/libxc/xc_pm.c')
-rw-r--r-- | tools/libxc/xc_pm.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c index 951c22c5c9..918c604010 100644 --- a/tools/libxc/xc_pm.c +++ b/tools/libxc/xc_pm.c @@ -307,6 +307,24 @@ int xc_set_cpufreq_para(int xc_handle, int cpuid, return xc_sysctl(xc_handle, &sysctl); } +int xc_get_cpufreq_avgfreq(int xc_handle, int cpuid, int *avg_freq) +{ + int ret = 0; + DECLARE_SYSCTL; + + if ( (xc_handle < 0) || (!avg_freq) ) + return -EINVAL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = GET_CPUFREQ_AVGFREQ; + sysctl.u.pm_op.cpuid = cpuid; + ret = xc_sysctl(xc_handle, &sysctl); + + *avg_freq = sysctl.u.pm_op.get_avgfreq; + + return ret; +} + int xc_get_cputopo(int xc_handle, struct xc_get_cputopo *info) { int rc; |