23 static void cpuidle_cpu_output(
unsigned int cpu,
int verbose)
25 int idlestates, idlestate;
28 printf(
_ (
"Analyzing CPU %d:\n"), cpu);
31 if (idlestates == 0) {
32 printf(
_(
"CPU %u: No idle states\n"), cpu);
34 }
else if (idlestates <= 0) {
35 printf(
_(
"CPU %u: Can't read idle state info\n"), cpu);
38 printf(
_(
"Number of idle states: %d\n"), idlestates);
39 printf(
_(
"Available idle states:"));
40 for (idlestate = 0; idlestate < idlestates; idlestate++) {
52 for (idlestate = 0; idlestate < idlestates; idlestate++) {
62 printf(
_(
"Flags/Description: %s\n"), tmp);
75 static void cpuidle_general_output(
void)
81 printf(
_(
"Could not determine cpuidle driver\n"));
85 printf(
_(
"CPUidle driver: %s\n"), tmp);
90 printf(
_(
"Could not determine cpuidle governor\n"));
94 printf(
_(
"CPUidle governor: %s\n"), tmp);
98 static void proc_cpuidle_cpu_output(
unsigned int cpu)
100 long max_allowed_cstate = 2000000000;
111 }
else if (cstates <= 0) {
112 printf(
_(
"CPU %u: Can't read C-state info\n"), cpu);
117 printf(
_(
"active state: C0\n"));
118 printf(
_(
"max_cstate: C%u\n"), cstates-1);
119 printf(
_(
"maximum allowed latency: %lu usec\n"), max_allowed_cstate);
121 for (cstate = 1; cstate < cstates; cstate++) {
123 "type[C%d] "), cstate, cstate);
124 printf(
_(
"promotion[--] demotion[--] "));
129 printf(
_(
"duration[%020Lu] \n"),
134 static struct option info_opts[] = {
135 { .name =
"silent", .has_arg = no_argument, .flag =
NULL, .val =
's'},
136 { .name =
"proc", .has_arg = no_argument, .flag =
NULL, .val =
'o'},
140 static inline void cpuidle_exit(
int fail)
148 extern int optind, opterr, optopt;
150 unsigned int cpu = 0;
153 ret = getopt_long(argc, argv,
"os", info_opts,
NULL);
178 switch (output_param) {
180 printf(
_(
"You can't specify more than one "
181 "output-specific argument\n"));
182 cpuidle_exit(EXIT_FAILURE);
184 printf(
_(
"invalid or unknown argument\n"));
185 cpuidle_exit(EXIT_FAILURE);
192 if (output_param == 0)
193 cpuidle_general_output();
202 switch (output_param) {
205 proc_cpuidle_cpu_output(cpu);
209 cpuidle_cpu_output(cpu,
verbose);