|
From: | Richard Frith-Macdonald |
Subject: | Re: NSProcessInfo -processorCount, -activeProcessorCount, -physicalMemory |
Date: | Thu, 13 Nov 2008 10:12:05 +0000 |
On 13 Nov 2008, at 08:42, Fred Kiefer wrote:
Having an implementation for these methods would be nice, but going downthe /proc/something parsing route seems wrong to me. Why not call sysconf() with _SC_NPROCESSORS_CONF (on my GUN/Linux system this is defined in /usr/include/bits/confname.h). This too is a system specific solution, but at least we use glibcinstead of doing the parsing ourselves. This should save us the problemof adopting to a new kernel every time. We still will need different solutions for non-Linux systems.
I've implemented a combination ... using sysconf if possible and falling back to the /proc code (though I'm not sure that /proc will ever work where sysconf does not) as well as adding an implementation for mswindows. The code compiles without error but is completely untested, so it would be good if anyone interested could try it out and report bugs.
[Prev in Thread] | Current Thread | [Next in Thread] |