Getting the CPU frequency in C

2007-09-09 Thread Martin Tournoij
I'm trying to get the CPU frequency in C: #include unistd.h #include time.h #include ctype.h #include sys/sysctl.h #include stdio.h #include sys/time.h int main() { int mib[2]; size_t size; struct clockinfo clockrate; mib[0] = CTL_KERN; mib[1] = KERN_CLOCKRATE; size =

Re: Getting the CPU frequency in C

2007-09-09 Thread Erik Trulsson
On Sun, Sep 09, 2007 at 10:50:25PM +0200, Martin Tournoij wrote: I'm trying to get the CPU frequency in C: #include unistd.h #include time.h #include ctype.h #include sys/sysctl.h #include stdio.h #include sys/time.h int main() { int mib[2]; size_t size; struct

Re: Getting the CPU frequency in C

2007-09-09 Thread Martin Tournoij
On Sun 09 Sep 2007 22:09, Erik Trulsson wrote: On Sun, Sep 09, 2007 at 10:50:25PM +0200, Martin Tournoij wrote: I'm trying to get the CPU frequency in C: #include unistd.h #include time.h #include ctype.h #include sys/sysctl.h #include stdio.h #include sys/time.h int main()

Re: Getting the CPU frequency in C

2007-09-09 Thread Mel
On Monday 10 September 2007 00:04:45 Martin Tournoij wrote: On Sun 09 Sep 2007 22:09, Erik Trulsson wrote: On Sun, Sep 09, 2007 at 10:50:25PM +0200, Martin Tournoij wrote: I'm trying to get the CPU frequency in C: #include unistd.h #include time.h #include ctype.h #include

Re: Getting the CPU frequency in C

2007-09-09 Thread Erik Trulsson
On Mon, Sep 10, 2007 at 12:04:45AM +0200, Martin Tournoij wrote: On Sun 09 Sep 2007 22:09, Erik Trulsson wrote: On Sun, Sep 09, 2007 at 10:50:25PM +0200, Martin Tournoij wrote: I'm trying to get the CPU frequency in C: #include unistd.h #include time.h #include ctype.h

Re: Getting the CPU frequency in C

2007-09-09 Thread Martin Tournoij
On Mon 10 Sep 2007 00:09, Erik Trulsson wrote: On Mon, Sep 10, 2007 at 12:04:45AM +0200, Martin Tournoij wrote: On Sun 09 Sep 2007 22:09, Erik Trulsson wrote: On Sun, Sep 09, 2007 at 10:50:25PM +0200, Martin Tournoij wrote: I'm trying to get the CPU frequency in C: #include

Re: Getting the CPU frequency in C

2007-09-09 Thread Mel
On Monday 10 September 2007 00:52:08 Martin Tournoij wrote: Thought you could only fetch the sysctl values defined in sys/sysctl.h with sysctl()/sysctlbyname(), apparently not... No, I believe those are guaranteed to be available (more to the point: made available through