Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect current CPU Clock Speed Programmatically on OS X?

I just bought a nifty MBA 13" Core i7. I'm told the CPU speed varies automatically, and pretty wildly, too. I'd really like to be able to monitor this with a simple app.

Are there any Cocoa or C calls to find the current clock speed, without actually affecting it?

Edit: I'm OK with answers using Terminal calls, as well as programmatic.

Thanks!

like image 759
Tim Avatar asked Mar 30 '12 19:03

Tim


People also ask

How do I monitor my CPU clock speed?

If you're wondering how to check your clock speed, click the Start menu (or click the Windows* key) and type “System Information.” Your CPU's model name and clock speed will be listed under “Processor”.


2 Answers

Try this tool called "Intel Power Gadget". It displays IA frequency and IA power in real time.

http://software.intel.com/sites/default/files/article/184535/intel-power-gadget-2.zip

like image 83
Yevgeni Avatar answered Sep 18 '22 15:09

Yevgeni


You can query the CPU speed easily via sysctl, either by command line:

sysctl hw.cpufrequency

Or via C:

#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>

int main() {
        int mib[2];
        unsigned int freq;
        size_t len;

        mib[0] = CTL_HW;
        mib[1] = HW_CPU_FREQ;
        len = sizeof(freq);
        sysctl(mib, 2, &freq, &len, NULL, 0);

        printf("%u\n", freq);

        return 0;
}
like image 23
DarkDust Avatar answered Sep 20 '22 15:09

DarkDust