[Bug java/58669] New: does not detect all cpu cores/threads

2013-10-09 Thread folkert at vanheusden dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

Bug ID: 58669
   Summary: does not detect all cpu cores/threads
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: java
  Assignee: unassigned at gcc dot gnu.org
  Reporter: folkert at vanheusden dot com

Created attachment 30970
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30970&action=edit
example code

When a java program compiled with gcj asks how many processing units are in the
system, it always returns 1.

folkert@belle:~$ cat test2.java
class test2 {
public static void main(String [] args) {
System.out.println("" +
Runtime.getRuntime().availableProcessors());
}
}
folkert@belle:~$ javac test2.java
folkert@belle:~$ java test2
12
folkert@belle:~$ gcj --main=test2 test2.java
folkert@belle:~$ ./a.out
1


[Bug java/58669] does not detect all cpu cores/threads

2013-10-09 Thread folkert at vanheusden dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

--- Comment #3 from Folkert van Heusden  ---
Did some googling and with appropriate #ifdefs it should be at least on linux
possible to retrieve this value:

sysconf(_SC_NPROCESSORS_ONLN);

If that function can't figure it out, it will return '1' which is somewhat
sensible.

On
http://stackoverflow.com/questions/150355/programmatically-find-the-number-of-cores-on-a-machine
I found a whole list of implementations for windows, *bsd, macos, aix, well I
think all relevant platforms.
Also
http://stackoverflow.com/questions/4586405/get-number-of-cpus-in-linux-using-c
gives some ideas.

If there's any further help I can do; let me know.