From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9468 invoked by alias); 18 Oct 2013 01:16:01 -0000 Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org Received: (qmail 9442 invoked by uid 89); 18 Oct 2013 01:15:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-we0-f178.google.com Received: from mail-we0-f178.google.com (HELO mail-we0-f178.google.com) (74.125.82.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 18 Oct 2013 01:15:57 +0000 Received: by mail-we0-f178.google.com with SMTP id q59so3066756wes.9 for ; Thu, 17 Oct 2013 18:15:54 -0700 (PDT) X-Received: by 10.180.98.228 with SMTP id el4mr237251wib.4.1382058954416; Thu, 17 Oct 2013 18:15:54 -0700 (PDT) Received: from carrie.the212.com (97e33f93.skybroadband.com. [151.227.63.147]) by mx.google.com with ESMTPSA id gp9sm21698597wib.8.2013.10.17.18.15.53 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Oct 2013 18:15:54 -0700 (PDT) Date: Fri, 18 Oct 2013 01:16:00 -0000 From: Andrew To: java-patches@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] PR58669: does not detect all cpu cores/threads Message-ID: <20131018011541.GA29495@carrie.the212.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4SFOXa2GPu3tIq4H" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-q4/txt/msg00000.txt.bz2 --4SFOXa2GPu3tIq4H Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 870 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58669 Testing: $ /usr/lib/jvm/icedtea-6/bin/java TestProcessors Processors: 8 $ /usr/lib/jvm/gcj-jdk/bin/java -version java version "1.5.0" gij (GNU libgcj) version 4.8.1 $ /usr/lib/jvm/gcj-jdk/bin/java TestProcessors Processors: 1 $ /home/andrew/build/gcj/bin/gij -version java version "1.5.0" gij (GNU libgcj) version 4.9.0 20131013 (experimental) [trunk revision 2035= 08] $ /home/andrew/build/gcj/bin/gij TestProcessors Processors: 8 ChangeLog: 2013-10-12 Andrew John Hughes * java/lang/natRuntime.cc: (availableProcessors()): Implement. Fixes PR gcc/58669. Ok for trunk and 4.8? --=20 Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint =3D EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 --jRHKVT23PllUwdXP Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pr58669.patch" Content-Transfer-Encoding: quoted-printable Content-length: 788 Index: libjava/java/lang/natRuntime.cc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libjava/java/lang/natRuntime.cc (revision 203508) +++ libjava/java/lang/natRuntime.cc (working copy) @@ -48,6 +48,10 @@ #include #endif =20 +#ifdef HAVE_UNISTD_H +#include +#endif + =0C =20 #ifdef USE_LTDL @@ -303,8 +307,15 @@ jint java::lang::Runtime::availableProcessors (void) { - // FIXME: find the real value. - return 1; + long procs =3D -1; + +#ifdef HAVE_UNISTD_H + procs =3D sysconf(_SC_NPROCESSORS_ONLN); +#endif + + if (procs =3D=3D -1) + return 1; + return (jint) procs; } =20 jstring --jRHKVT23PllUwdXP-- --4SFOXa2GPu3tIq4H Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBCgAGBQJSYIu9AAoJEDuWpXgki9wHP1EP/iT3yGhWzOMnUSCX5UUf/n4N lfhoD2Kmq8JWPH9VqYY2SK8n3BsYyrgSThsNgpcHqG+fBrMn0za9WMhpEEfKE8kv PAvx9QKcLiV03KHjkqyx/DxBE6zxqPjVaPQmuwhzkNSuhGeSyE5bgy7P9huXeSrE wMee/RuEcSFAHN7Z7Fytt3hX0Qx0uX8CmhUwL52l398wo9VOQmdRNckInXCaJ6Wg mshYO3BROio+c6n5fipxpIDSveuan1KRP+RH5Xoq/YCqBwOT2QyGDnxvwTIrqRP0 d1f98ENPuGt1KPh/SFVnl6YkcZnyGgNBWqZMNk3cYkiE7/mAmIDYoOoo4wq6dUId iXpx/+litC1eD3HeJWAEphzpDkT9bqVbBz85+QwzzggTlfzKwcOjaIBAm9QZyJDp RBYWDzzOODI0gutLBaIBrl4DLIv2gYngWfYLDDZkD3K0I+0xWyV2MtqLPF5GvYOU C0st2nG6cHzQRtNiU/gN4K3ASB4ZHK5nlL1r1WqjGBW4i3d43rA9fCT0CeYSSSD6 lZF0rJmY/cJik4e0uveCjwflPuRXTiceyYBFj0IJI5bd18vWR880Z0pGK3hWcrwm HS4Da/JQjf3UB1Oc0O/tlkhsSjnll8k2QwQ8NzXdzkZpMZd1TqE4OShUbyz4qu7C 78yRhXGHMqwTA6cvXkt4 =dreJ -----END PGP SIGNATURE----- --4SFOXa2GPu3tIq4H--