On 15 May 2006, at 18:50, Chris Vetter wrote:

On 2006-05-15 15:57:30 +0200 David Chisnall <[EMAIL PROTECTED]> wrote:
[...]
I have tested the FreeBSD and Darwin back ends (the FreeBSD code works on FreeBSD 4.11 and 6.1), and the Linux code should have been tested already.
[...]

Since you apparently have FreeBSD4.x available, try something like the following.

That seems to give the same answer as my code for FreeBSD < 5 on my FreeBSD 4.11 box, even under heavy load (although I didn't test it with large process counts. It will, of course, only work on x86. I don't know how well my code will work on non-x86 platforms (I've not tested it).

You will have to come up with a definition for the #if statements, theoretically #if (__FreeBSD_version < 5) should work.

Since that segment of the code will only be reached if the sysctl fails, we don't need to bother testing for FreeBSD < 5 at compile time - it's just a fall-back mechanism. It would be worth wrapping it in #ifdefs that detect x86 CPUs though. I can't remember the correct macro to test for in these cases though. It does seem worth adding as another fallback, however.

Another option is to try looking in /compat/linux/proc/cpuinfo. If the user has Linux compatibility turned on and this mounted then it will contain a line that looks something like this:

cpu MHz         : 2539.10

And the Linux code can be used to parse it. It does seem a lot of effort to go to to support an obsolete version of a free platform, however. I suspect the only FreeBSD 4.x and earlier machines that still exist are servers, and so don't actually need Étoilé (mine is headless).
_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev

Reply via email to