how find out CPU clockrate?
girgen at pingpong.net
Fri Jan 9 16:34:14 PST 2004
It a sound library, JACK. I dunno, I'll try commenting the code, see what
--On fredag, januari 09, 2004 17.42.15 -0600 Dan Nelson
<dnelson at allantgroup.com> wrote:
> In the last episode (Jan 10), Palle Girgensohn said:
>> How can I programatically find out the CPU frequency?
>> I'm trying to port a program from Linux, and it uses /proc/cpuinfo.
>> $ cat /compat/linux/proc/cpuinfo
>> cpu MHz : 349.20
>> Pretty neat, but it does not exist in FreeBSD, and sysctl does not
>> give out this information. Grepping the dmesg.boot seems somewhat odd
>> for a C program:
>> $ dmesg | grep -i hz
>> Timecounter "i8254" frequency 1193182 Hz
>> CPU: Pentium II/Pentium II Xeon/Celeron (349.20-MHz 686-class CPU)
>> Better ideas?
> I think someone suggested that more CPU information be exported via
> sysctl nodes at some point, but no-one has found it important enough to
> code. Note that on laptops and many ACPI motherboards, you can tweak
> the CPU speed on the fly, so you can't just store the bootup value.
> Other architectures may also allow multiple CPUs at different speeds.
> As for your issue, I'd say just comment the code out. Do you really
> need to know the CPU speed? Another option is to shell out and run
> cpuid or x86info, but those are x86-only, of course.
> Dan Nelson
> dnelson at allantgroup.com
More information about the freebsd-questions