Skip to contentSkip to conversation

Invoking cpufreq from a C program

DISCUSSION Drew Varner 2 participants 2 messages Jan 30, 2004 – Feb 8, 2004

lore
Share & tools
lore
#0 lore raw

Hey Folks,

I want to invoke cpufreq (change processor performance states) from C code. Should I use the /proc interface or import the cpufreq libraries?

My first guess is that the /proc interface is the best idea, to protect me from changes in the libraries. Also, I assume that the overhead of going through /proc is minimal compared to the latency the processor needs to change freqs. I think there's probably some voodoo involved in invoking kernel code from userspace, but I have never done it.

I'd appreciate any guidance on the "best" way to go about this.

Thanks,
Drew

#1 lore raw

Hi,

Quoted 4 lines · Drew Varner

Hey Folks,

I want to invoke cpufreq (change processor performance states) from C code. Should I use the /proc interface or import the cpufreq libraries?

You should use the sysfs interface, and the userspace cpufreq governor.

However, a kernel based cpufreq governor might be a better choice -- depending on what you intend to do...

Dominik

_______________________________________________
Cpufreq mailing list
[email protected]
http://www.linux.org.uk/mailman/listinfo/cpufreq