tools/power/cpupower/utils/cpupower-info.c
Source file repositories/reference/linux-study-clean/tools/power/cpupower/utils/cpupower-info.c
File Facts
- System
- Linux kernel
- Corpus path
tools/power/cpupower/utils/cpupower-info.c- Extension
.c- Size
- 2315 bytes
- Lines
- 113
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
unistd.hstdio.hstdlib.herrno.hstring.hgetopt.hsys/utsname.hhelpers/helpers.hhelpers/sysfs.h
Detected Declarations
function print_wrong_arg_exitfunction cmd_info
Annotated Snippet
switch (ret) {
case 'b':
if (params.perf_bias)
print_wrong_arg_exit();
params.perf_bias = 1;
break;
default:
print_wrong_arg_exit();
}
}
if (!params.params)
params.params = 0x7;
/* Default is: show output of base_cpu only */
if (bitmask_isallclear(cpus_chosen))
bitmask_setbit(cpus_chosen, base_cpu);
/* Add more per cpu options here */
if (!params.perf_bias)
return ret;
if (params.perf_bias) {
if (!run_as_root) {
params.perf_bias = 0;
printf(_("Intel's performance bias setting needs root privileges\n"));
} else if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_PERF_BIAS)) {
printf(_("System does not support Intel's performance"
" bias setting\n"));
params.perf_bias = 0;
}
}
/* loop over CPUs */
for (cpu = bitmask_first(cpus_chosen);
cpu <= bitmask_last(cpus_chosen); cpu++) {
if (!bitmask_isbitset(cpus_chosen, cpu))
continue;
printf(_("analyzing CPU %d:\n"), cpu);
if (sysfs_is_cpu_online(cpu) != 1){
printf(_(" *is offline\n"));
continue;
}
if (params.perf_bias) {
ret = cpupower_intel_get_perf_bias(cpu);
if (ret < 0) {
fprintf(stderr,
_("Could not read perf-bias value[%d]\n"), ret);
exit(EXIT_FAILURE);
} else
printf(_("perf-bias: %d\n"), ret);
}
}
return 0;
}
Annotation
- Immediate include surface: `unistd.h`, `stdio.h`, `stdlib.h`, `errno.h`, `string.h`, `getopt.h`, `sys/utsname.h`, `helpers/helpers.h`.
- Detected declarations: `function print_wrong_arg_exit`, `function cmd_info`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.