2 * (C) 2011 Thomas Renninger <trenn@suse.de>, Novell Inc.
4 * Licensed under the terms of the GNU GPL License version 2.
16 #include "helpers/helpers.h"
17 #include "helpers/sysfs.h"
19 static struct option set_opts
[] = {
20 {"perf-bias", optional_argument
, NULL
, 'b'},
24 static void print_wrong_arg_exit(void)
26 printf(_("invalid or unknown argument\n"));
30 int cmd_info(int argc
, char **argv
)
33 extern int optind
, opterr
, optopt
;
44 setlocale(LC_ALL
, "");
47 /* parameter parsing */
48 while ((ret
= getopt_long(argc
, argv
, "b", set_opts
, NULL
)) != -1) {
52 print_wrong_arg_exit();
56 print_wrong_arg_exit();
63 /* Default is: show output of CPU 0 only */
64 if (bitmask_isallclear(cpus_chosen
))
65 bitmask_setbit(cpus_chosen
, 0);
67 /* Add more per cpu options here */
68 if (!params
.perf_bias
)
71 if (params
.perf_bias
) {
74 printf(_("Intel's performance bias setting needs root privileges\n"));
75 } else if (!(cpupower_cpu_info
.caps
& CPUPOWER_CAP_PERF_BIAS
)) {
76 printf(_("System does not support Intel's performance"
83 for (cpu
= bitmask_first(cpus_chosen
);
84 cpu
<= bitmask_last(cpus_chosen
); cpu
++) {
86 if (!bitmask_isbitset(cpus_chosen
, cpu
) ||
87 cpufreq_cpu_exists(cpu
))
90 printf(_("analyzing CPU %d:\n"), cpu
);
92 if (params
.perf_bias
) {
93 ret
= msr_intel_get_perf_bias(cpu
);
96 _("Could not read perf-bias value[%d]\n"), ret
);
99 printf(_("perf-bias: %d\n"), ret
);