1 // SPDX-License-Identifier: GPL-2.0-only
3 * (C) 2011 Thomas Renninger <trenn@suse.de>, Novell Inc.
13 #include <sys/utsname.h>
15 #include "helpers/helpers.h"
16 #include "helpers/sysfs.h"
18 static struct option set_opts
[] = {
19 {"perf-bias", optional_argument
, NULL
, 'b'},
23 static void print_wrong_arg_exit(void)
25 printf(_("invalid or unknown argument\n"));
29 int cmd_info(int argc
, char **argv
)
32 extern int optind
, opterr
, optopt
;
45 if (!ret
&& (!strcmp(uts
.machine
, "ppc64le") ||
46 !strcmp(uts
.machine
, "ppc64"))) {
47 fprintf(stderr
, _("Subcommand not supported on POWER.\n"));
51 setlocale(LC_ALL
, "");
54 /* parameter parsing */
55 while ((ret
= getopt_long(argc
, argv
, "b", set_opts
, NULL
)) != -1) {
59 print_wrong_arg_exit();
63 print_wrong_arg_exit();
70 /* Default is: show output of CPU 0 only */
71 if (bitmask_isallclear(cpus_chosen
))
72 bitmask_setbit(cpus_chosen
, 0);
74 /* Add more per cpu options here */
75 if (!params
.perf_bias
)
78 if (params
.perf_bias
) {
81 printf(_("Intel's performance bias setting needs root privileges\n"));
82 } else if (!(cpupower_cpu_info
.caps
& CPUPOWER_CAP_PERF_BIAS
)) {
83 printf(_("System does not support Intel's performance"
90 for (cpu
= bitmask_first(cpus_chosen
);
91 cpu
<= bitmask_last(cpus_chosen
); cpu
++) {
93 if (!bitmask_isbitset(cpus_chosen
, cpu
))
96 printf(_("analyzing CPU %d:\n"), cpu
);
98 if (sysfs_is_cpu_online(cpu
) != 1){
99 printf(_(" *is offline\n"));
103 if (params
.perf_bias
) {
104 ret
= msr_intel_get_perf_bias(cpu
);
107 _("Could not read perf-bias value[%d]\n"), ret
);
110 printf(_("perf-bias: %d\n"), ret
);