tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
Source file repositories/reference/linux-study-clean/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
File Facts
- System
- Linux kernel
- Corpus path
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h- Extension
.h- Size
- 2405 bytes
- Lines
- 96
- 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
stdarg.htime.hidle_monitor/idle_monitors.hsched.hsys/types.hunistd.h
Detected Declarations
struct cpuidle_monitorenum power_range_efunction bind_cpu
Annotated Snippet
struct cpuidle_monitor {
/* Name must not contain whitespaces */
char name[MONITOR_NAME_LEN];
int name_len;
int hw_states_num;
cstate_t *hw_states;
int (*start) (void);
int (*stop) (void);
struct cpuidle_monitor* (*do_register) (void);
void (*unregister)(void);
unsigned int overflow_s;
struct {
unsigned int needs_root:1;
unsigned int per_cpu_schedule:1;
} flags;
};
extern long long timespec_diff_us(struct timespec start, struct timespec end);
#define print_overflow_err(mes, ov) \
{ \
fprintf(stderr, gettext("Measure took %u seconds, but registers could " \
"overflow at %u seconds, results " \
"could be inaccurate\n"), mes, ov); \
}
/* Taken over from x86info project sources -> return 0 on success */
#include <sched.h>
#include <sys/types.h>
#include <unistd.h>
static inline int bind_cpu(int cpu)
{
cpu_set_t set;
if (sched_getaffinity(getpid(), sizeof(set), &set) == 0) {
CPU_ZERO(&set);
CPU_SET(cpu, &set);
return sched_setaffinity(getpid(), sizeof(set), &set);
}
return 1;
}
#endif /* __CPUIDLE_INFO_HW__ */
Annotation
- Immediate include surface: `stdarg.h`, `time.h`, `idle_monitor/idle_monitors.h`, `sched.h`, `sys/types.h`, `unistd.h`.
- Detected declarations: `struct cpuidle_monitor`, `enum power_range_e`, `function bind_cpu`.
- 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.