Alright, I've integrated David's changes, but I'm not sure I did it right for platforms other than Linux and unsupported platforms. Could somebody please check it?
Things I changed on David's code: - reformatted it to GNU style. It's not like Etoile has a particular bias towards it, but I do, and since the rest of EtoileMenuServer is in it, I'd like to keep things consistent. - reorganized classes - the ETMachineInfo class now handles all platform-independent portions and includes dummy fillers for platform-specific methods in case the given platform is not defined. - changed the makefile definitions to compile all source files (since all of the EtoileMenuServer project is managed by ProjectManager and that doesn't allow to conditionally change the source file list depending on the platform), but instead protected the code by using ifdef's (i.e. FreeBSD code doesn't get compiled unless you are running FreeBSD). - made memory sizes of up to MB rounded to integer values (so it doesn't spit out (511.65MB, but instead 512MB). As for the FreeBSD < 5 yes or no discussion I'm for no - FreeBSD 4 is really old. -- Saso On 5/15/06, David Chisnall <[EMAIL PROTECTED]> wrote:
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
_______________________________________________ Etoile-dev mailing list [email protected] https://mail.gna.org/listinfo/etoile-dev
