< prev index next >

common/autoconf/build-performance.m4

Print this page


   1 #
   2 # Copyright (c) 2011, 2015, 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


  24 #
  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/system_profiler; then
  41     # Looks like a MacOSX system
  42     NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
  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
  67 
  68   if test -f /proc/meminfo; then
  69     # Looks like a Linux (or cygwin) system
  70     MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
  71     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
  72     FOUND_MEM=yes
  73   elif test -x /usr/sbin/prtconf; then
  74     # Looks like a Solaris or AIX system
  75     MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
  76     FOUND_MEM=yes
  77   elif test -x /usr/sbin/system_profiler; then
  78     # Looks like a MacOSX system
  79     MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
  80     MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`





  81     FOUND_MEM=yes
  82   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
  83     # Windows, but without cygwin
  84     MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
  85     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  86     FOUND_MEM=yes
  87   fi
  88 
  89   if test "x$FOUND_MEM" = xyes; then
  90     AC_MSG_RESULT([$MEMORY_SIZE MB])
  91   else
  92     AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
  93     AC_MSG_WARN([This might seriously impact build performance!])
  94   fi
  95 ])
  96 
  97 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
  98 [
  99   # How many cores do we have on this build system?
 100   AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],


   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


  24 #
  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/system_profiler; then
  41     # Looks like a MacOSX system
  42     NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk  '{print [$]5}'`
  43     FOUND_CORES=yes
  44   elif test -x /sbin/sysctl; then
  45     # Looks like a BSD system
  46     NUM_CORES=`/sbin/sysctl -n hw.ncpu`
  47     FOUND_CORES=yes
  48   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
  49     NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
  50     FOUND_CORES=yes
  51   elif test -n "$NUMBER_OF_PROCESSORS"; then
  52     # On windows, look in the env
  53     NUM_CORES=$NUMBER_OF_PROCESSORS
  54     FOUND_CORES=yes
  55   fi
  56 
  57   if test "x$FOUND_CORES" = xyes; then
  58     AC_MSG_RESULT([$NUM_CORES])
  59   else
  60     AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
  61     AC_MSG_WARN([This will disable all parallelism from build!])
  62   fi
  63 ])
  64 
  65 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
  66 [
  67   AC_MSG_CHECKING([for memory size])
  68   # Default to 1024 MB
  69   MEMORY_SIZE=1024
  70   FOUND_MEM=no
  71 
  72   if test -f /proc/meminfo; then
  73     # Looks like a Linux (or cygwin) system
  74     MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
  75     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
  76     FOUND_MEM=yes
  77   elif test -x /usr/sbin/prtconf; then
  78     # Looks like a Solaris or AIX system
  79     MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
  80     FOUND_MEM=yes
  81   elif test -x /usr/sbin/system_profiler; then
  82     # Looks like a MacOSX system
  83     MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk  '{print [$]2}'`
  84     MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
  85     FOUND_MEM=yes
  86   elif test -x /sbin/sysctl; then
  87     # Looks like a BSD system
  88     MEMORY_SIZE=`/sbin/sysctl -n hw.physmem`
  89     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  90     FOUND_MEM=yes
  91   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
  92     # Windows, but without cygwin
  93     MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
  94     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  95     FOUND_MEM=yes
  96   fi
  97 
  98   if test "x$FOUND_MEM" = xyes; then
  99     AC_MSG_RESULT([$MEMORY_SIZE MB])
 100   else
 101     AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
 102     AC_MSG_WARN([This might seriously impact build performance!])
 103   fi
 104 ])
 105 
 106 AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
 107 [
 108   # How many cores do we have on this build system?
 109   AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],


< prev index next >