Xenpm command

From Xen

xenpm

Xenpm is a userspace tool that can list the power information of available processors and control the power policy according to users' preference. Its name stands for Xen Power Management(xenpm for short).

xenpm usage is as follow

usage: xenpm <command> [args]
xenpm command list:
 get-cpuidle-states    [cpuid]       list cpu idle info of CPU <cpuid> or all
 get-cpufreq-states    [cpuid]       list cpu freq info of CPU <cpuid> or all
 get-cpufreq-para      [cpuid]       list cpu freq parameter of CPU <cpuid> or all
 set-scaling-maxfreq   [cpuid] <HZ>  set max cpu frequency <HZ> on CPU <cpuid>
                                     or all CPUs
 set-scaling-minfreq   [cpuid] <HZ>  set min cpu frequency <HZ> on CPU <cpuid>
                                     or all CPUs
 set-scaling-speed     [cpuid] <num> set scaling speed on CPU <cpuid> or all
                                     it is used in userspace governor.
 set-scaling-governor  [cpuid] <gov> set scaling governor on CPU <cpuid> or all
                                     as userspace/performance/powersave/ondemand
 set-sampling-rate     [cpuid] <num> set sampling rate on CPU <cpuid> or all
                                     it is used in ondemand governor.
 set-up-threshold      [cpuid] <num> set up threshold on CPU <cpuid> or all
                                     it is used in ondemand governor.
 get-cpu-topology                    get thread/core/socket topology info
 set-sched-smt           enable|disable enable/disable scheduler smt power saving
 set-vcpu-migration-delay      <num> set scheduler vcpu migration delay in us
 get-vcpu-migration-delay            get scheduler vcpu migration delay
 set-max-cstate        <num>         set the C-State limitation (<num> >= 0)
 start [seconds]                     start collect Cx/Px statistics,
                                     output after CTRL-C or SIGINT or several seconds.
 enable-turbo-mode     [cpuid]       enable Turbo Mode for processors that support it.
 disable-turbo-mode    [cpuid]       disable Turbo Mode for processors that support it.

basically it has following functions:

  1. Show C-state status with sub-command "get-cpuidle-states"
  2. Show P-state status with sub-command "get-cpufreq-states"
  3. Control cpufreq parameter, with sub-command "get-cpufreq-para", "set-scaling-maxfreq", "set-scaling-minfreq", "set-scaling-speed", "set-scaling-governor", "set-sampling-rate", "set-up-threshold"
  4. Get / set vcpu migration delay
  5. Set max C-state limitaton
  6. Sampling C/P state status in specified period, with sub-command "start"
  7. Enable / Disable turbo mode

the first three functions have already been illustrated in the previous cpufreq and cpuidle section, the fourth function aims to provide a overall picture of PM activity in specified period. For example, the follow command measure the C/P activity in 5 minutes


# xenpm start &  sleep 5; killall -s SIGINT xenpm
Elapsed time (ms): 5028
CPU0:
        residency       percentage
  C0    59 ms   1.18%
  C1    0 ms    0.00%
  C2    56 ms   1.13%
  C3    4912 ms 97.69%
  P0    0 ms    0.00%
  P1    0 ms    0.00%
  P2    0 ms    0.00%
  P3    7 ms    100.00%
CPU1:
        residency       percentage
  C0    118 ms  2.36%
  C1    0 ms    0.00%
  C2    36 ms   0.73%
  C3    4873 ms 96.91%
  P0    0 ms    0.00%
  P1    0 ms    0.00%
  P2    0 ms    0.00%
  P3    63 ms   100.00%

Also see