public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/58669] New: does not detect all cpu cores/threads
@ 2013-10-09 15:54 folkert at vanheusden dot com
  2013-10-09 16:27 ` [Bug java/58669] " gnu_andrew at member dot fsf.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: folkert at vanheusden dot com @ 2013-10-09 15:54 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
@ 2013-10-09 16:27 ` gnu_andrew at member dot fsf.org
  2013-10-09 16:35 ` gnu_andrew at member dot fsf.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gnu_andrew at member dot fsf.org @ 2013-10-09 16:27 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

Andrew John Hughes <gnu_andrew at member dot fsf.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-09
                 CC|                            |gnu_andrew at member dot fsf.org
     Ever confirmed|0                           |1

--- Comment #1 from Andrew John Hughes <gnu_andrew at member dot fsf.org> ---
jint
java::lang::Runtime::availableProcessors (void)
{
  // FIXME: find the real value.                                                
  return 1;
}

:)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
  2013-10-09 16:27 ` [Bug java/58669] " gnu_andrew at member dot fsf.org
@ 2013-10-09 16:35 ` gnu_andrew at member dot fsf.org
  2013-10-09 16:36 ` folkert at vanheusden dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gnu_andrew at member dot fsf.org @ 2013-10-09 16:35 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

--- Comment #2 from Andrew John Hughes <gnu_andrew at member dot fsf.org> ---
This is easily fixed with sysconf(_SC_NPROCESSORS_ONLN);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
  2013-10-09 16:27 ` [Bug java/58669] " gnu_andrew at member dot fsf.org
  2013-10-09 16:35 ` gnu_andrew at member dot fsf.org
@ 2013-10-09 16:36 ` folkert at vanheusden dot com
  2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: folkert at vanheusden dot com @ 2013-10-09 16:36 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

--- Comment #3 from Folkert van Heusden <folkert at vanheusden dot com> ---
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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
                   ` (3 preceding siblings ...)
  2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
@ 2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
  2013-10-18  1:17 ` gnu_andrew at member dot fsf.org
  5 siblings, 0 replies; 7+ messages in thread
From: gnu_andrew at member dot fsf.org @ 2013-10-09 18:36 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

--- Comment #4 from Andrew John Hughes <gnu_andrew at member dot fsf.org> ---
Yes, I just said that above.  I'll propose a patch when I get chance.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
                   ` (2 preceding siblings ...)
  2013-10-09 16:36 ` folkert at vanheusden dot com
@ 2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
  2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
  2013-10-18  1:17 ` gnu_andrew at member dot fsf.org
  5 siblings, 0 replies; 7+ messages in thread
From: gnu_andrew at member dot fsf.org @ 2013-10-09 18:36 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

--- Comment #5 from Andrew John Hughes <gnu_andrew at member dot fsf.org> ---
Thanks for reporting this.  I'll let you know when a fix is committed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug java/58669] does not detect all cpu cores/threads
  2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
                   ` (4 preceding siblings ...)
  2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
@ 2013-10-18  1:17 ` gnu_andrew at member dot fsf.org
  5 siblings, 0 replies; 7+ messages in thread
From: gnu_andrew at member dot fsf.org @ 2013-10-18  1:17 UTC (permalink / raw)
  To: java-prs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58669

Andrew John Hughes <gnu_andrew at member dot fsf.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |gnu_andrew at member dot fsf.org

--- Comment #6 from Andrew John Hughes <gnu_andrew at member dot fsf.org> ---
http://gcc.gnu.org/ml/java-patches/2013-q4/msg00000.html


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-10-18  1:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-09 15:54 [Bug java/58669] New: does not detect all cpu cores/threads folkert at vanheusden dot com
2013-10-09 16:27 ` [Bug java/58669] " gnu_andrew at member dot fsf.org
2013-10-09 16:35 ` gnu_andrew at member dot fsf.org
2013-10-09 16:36 ` folkert at vanheusden dot com
2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
2013-10-09 18:36 ` gnu_andrew at member dot fsf.org
2013-10-18  1:17 ` gnu_andrew at member dot fsf.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).