[buug] How to get the CPU frequency

Jon McClintock jammer at weak.org
Sat Feb 8 08:55:06 PST 2003


On Sat, Feb 08, 2003 at 04:44:42PM +0530, Abhay Kumar Srivastava wrote:
> I need to get the CPU frequency programmatically, how do I do that?
> printf("%d\n",sysconf(_SC_CLK_TCK));
> printf("%d\n", CLOCKS_PER_SEC);
> does not help, they  show the same value (128) on different machines
> with different CPU speed.

What OS are you running on? From the looks of it, not Linux (since Linux
uses an HZ value of 100 most often). One of the BSDs?

-Jon



More information about the buug mailing list