tools/power/cpupower/lib/cpufreq.h
Source file repositories/reference/linux-study-clean/tools/power/cpupower/lib/cpufreq.h
File Facts
- System
- Linux kernel
- Corpus path
tools/power/cpupower/lib/cpufreq.h- Extension
.h- Size
- 5776 bytes
- Lines
- 231
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct cpufreq_policystruct cpufreq_available_governorsstruct cpufreq_available_frequenciesstruct cpufreq_affected_cpusstruct cpufreq_stats
Annotated Snippet
struct cpufreq_policy {
unsigned long min;
unsigned long max;
char *governor;
};
struct cpufreq_available_governors {
char *governor;
struct cpufreq_available_governors *next;
struct cpufreq_available_governors *first;
};
struct cpufreq_available_frequencies {
unsigned long frequency;
struct cpufreq_available_frequencies *next;
struct cpufreq_available_frequencies *first;
};
struct cpufreq_affected_cpus {
unsigned int cpu;
struct cpufreq_affected_cpus *next;
struct cpufreq_affected_cpus *first;
};
struct cpufreq_stats {
unsigned long frequency;
unsigned long long time_in_state;
struct cpufreq_stats *next;
struct cpufreq_stats *first;
};
#ifdef __cplusplus
extern "C" {
#endif
/* determine current CPU frequency
* - _kernel variant means kernel's opinion of CPU frequency
* - _hardware variant means actual hardware CPU frequency,
* which is only available to root.
*
* returns 0 on failure, else frequency in kHz.
*/
unsigned long cpufreq_get_freq_kernel(unsigned int cpu);
unsigned long cpufreq_get_freq_hardware(unsigned int cpu);
#define cpufreq_get(cpu) cpufreq_get_freq_kernel(cpu);
/* determine CPU transition latency
*
* returns 0 on failure, else transition latency in 10^(-9) s = nanoseconds
*/
unsigned long cpufreq_get_transition_latency(unsigned int cpu);
/* determine energy performance preference
*
* returns NULL on failure, else the string that represents the energy performance
* preference requested.
*/
char *cpufreq_get_energy_performance_preference(unsigned int cpu);
void cpufreq_put_energy_performance_preference(char *ptr);
/* determine hardware CPU frequency limits
*
* These may be limited further by thermal, energy or other
* considerations by cpufreq policy notifiers in the kernel.
*/
int cpufreq_get_hardware_limits(unsigned int cpu,
unsigned long *min,
unsigned long *max);
/* determine CPUfreq driver used
*
* Remember to call cpufreq_put_driver when no longer needed
* to avoid memory leakage, please.
*/
char *cpufreq_get_driver(unsigned int cpu);
void cpufreq_put_driver(char *ptr);
Annotation
- Detected declarations: `struct cpufreq_policy`, `struct cpufreq_available_governors`, `struct cpufreq_available_frequencies`, `struct cpufreq_affected_cpus`, `struct cpufreq_stats`.
- 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.