< prev index next >

make/autoconf/build-performance.m4

Print this page


   1 #
   2 # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  25 
  26 AC_DEFUN([BPERF_CHECK_CORES],
  27 [
  28   AC_MSG_CHECKING([for number of cores])
  29   NUM_CORES=1
  30   FOUND_CORES=no
  31 
  32   if test -f /proc/cpuinfo; then
  33     # Looks like a Linux (or cygwin) system
  34     NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
  35     FOUND_CORES=yes
  36   elif test -x /usr/sbin/psrinfo; then
  37     # Looks like a Solaris system
  38     NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
  39     FOUND_CORES=yes
  40   elif test -x /usr/sbin/sysctl; then
  41     # Looks like a MacOSX system
  42     NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
  43     FOUND_CORES=yes
  44   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
  45     NUM_LCPU=`lparstat -m 2> /dev/null | $GREP -o "lcpu=[[0-9]]*" | $CUT -d "=" -f 2`
  46     if test -n "$NUM_LCPU"; then
  47       NUM_CORES=$NUM_LCPU
  48       FOUND_CORES=yes
  49     fi
  50   elif test -n "$NUMBER_OF_PROCESSORS"; then
  51     # On windows, look in the env
  52     NUM_CORES=$NUMBER_OF_PROCESSORS
  53     FOUND_CORES=yes
  54   fi
  55 
  56   if test "x$FOUND_CORES" = xyes; then
  57     AC_MSG_RESULT([$NUM_CORES])
  58   else
  59     AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
  60     AC_MSG_WARN([This will disable all parallelism from build!])
  61   fi
  62 ])
  63 
  64 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
  65 [
  66   AC_MSG_CHECKING([for memory size])
  67   # Default to 1024 MB
  68   MEMORY_SIZE=1024
  69   FOUND_MEM=no


   1 #
   2 # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  25 
  26 AC_DEFUN([BPERF_CHECK_CORES],
  27 [
  28   AC_MSG_CHECKING([for number of cores])
  29   NUM_CORES=1
  30   FOUND_CORES=no
  31 
  32   if test -f /proc/cpuinfo; then
  33     # Looks like a Linux (or cygwin) system
  34     NUM_CORES=`cat /proc/cpuinfo  | grep -c processor`
  35     FOUND_CORES=yes
  36   elif test -x /usr/sbin/psrinfo; then
  37     # Looks like a Solaris system
  38     NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
  39     FOUND_CORES=yes
  40   elif test -x /usr/sbin/sysctl; then
  41     # Looks like a MacOSX system
  42     NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
  43     FOUND_CORES=yes
  44   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
  45     NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
  46     FOUND_CORES=yes



  47   elif test -n "$NUMBER_OF_PROCESSORS"; then
  48     # On windows, look in the env
  49     NUM_CORES=$NUMBER_OF_PROCESSORS
  50     FOUND_CORES=yes
  51   fi
  52 
  53   if test "x$FOUND_CORES" = xyes; then
  54     AC_MSG_RESULT([$NUM_CORES])
  55   else
  56     AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
  57     AC_MSG_WARN([This will disable all parallelism from build!])
  58   fi
  59 ])
  60 
  61 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
  62 [
  63   AC_MSG_CHECKING([for memory size])
  64   # Default to 1024 MB
  65   MEMORY_SIZE=1024
  66   FOUND_MEM=no


< prev index next >