< prev index next >

make/autoconf/build-performance.m4

Print this page
rev 59383 : [mq]: final


  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
  23 # questions.
  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     if test "$NUM_CORES" -eq "0"; then
  36       NUM_CORES=`cat /proc/cpuinfo  | grep -c ^CPU`
  37     fi
  38     if test "$NUM_CORES" -ne "0"; then
  39       FOUND_CORES=yes
  40     fi
  41   elif test -x /usr/sbin/psrinfo; then
  42     # Looks like a Solaris system
  43     NUM_CORES=`/usr/sbin/psrinfo -v | grep -c on-line`
  44     FOUND_CORES=yes
  45   elif test -x /usr/sbin/sysctl; then
  46     # Looks like a MacOSX system
  47     NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
  48     FOUND_CORES=yes
  49   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
  50     NUM_LCPU=`lparstat -m 2> /dev/null | $GREP -o "lcpu=[[0-9]]*" | $CUT -d "=" -f 2`
  51     if test -n "$NUM_LCPU"; then
  52       NUM_CORES=$NUM_LCPU
  53       FOUND_CORES=yes
  54     fi
  55   elif test -n "$NUMBER_OF_PROCESSORS"; then
  56     # On windows, look in the env
  57     NUM_CORES=$NUMBER_OF_PROCESSORS
  58     FOUND_CORES=yes
  59   fi
  60 
  61   if test "x$FOUND_CORES" = xyes; then
  62     AC_MSG_RESULT([$NUM_CORES])
  63   else
  64     AC_MSG_RESULT([could not detect number of cores, defaulting to 1])
  65     AC_MSG_WARN([This will disable all parallelism from build!])
  66   fi
  67 ])
  68 
  69 AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
  70 [
  71   AC_MSG_CHECKING([for memory size])
  72   # Default to 1024 MB
  73   MEMORY_SIZE=1024
  74   FOUND_MEM=no
  75 
  76   if test -f /proc/meminfo; then
  77     # Looks like a Linux (or cygwin) system
  78     MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
  79     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
  80     FOUND_MEM=yes
  81   elif test -x /usr/sbin/prtconf; then
  82     # Looks like a Solaris or AIX system
  83     MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
  84     FOUND_MEM=yes
  85   elif test -x /usr/sbin/sysctl; then
  86     # Looks like a MacOSX system
  87     MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
  88     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  89     FOUND_MEM=yes
  90   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
  91     # Windows, but without cygwin
  92     MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
  93     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  94     FOUND_MEM=yes
  95   fi
  96 
  97   if test "x$FOUND_MEM" = xyes; then
  98     AC_MSG_RESULT([$MEMORY_SIZE MB])
  99   else
 100     AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
 101     AC_MSG_WARN([This might seriously impact build performance!])
 102   fi


 352       AC_MSG_CHECKING([for icecc build environment for build compiler])
 353       AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
 354       BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
 355           ICECC_CXX=${BUILD_CXX} ${ICECC_CMD}"
 356     else
 357       BUILD_ICECC="${ICECC}"
 358     fi
 359   fi
 360 
 361   AC_SUBST(ICECC)
 362   AC_SUBST(BUILD_ICECC)
 363 ])
 364 
 365 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
 366 [
 367   # Are precompiled headers available?
 368   PRECOMPILED_HEADERS_AVAILABLE=true
 369   AC_MSG_CHECKING([if precompiled headers are available])
 370   if test "x$ICECC" != "x"; then
 371     AC_MSG_RESULT([no, does not work effectively with icecc])
 372     PRECOMPILED_HEADERS_AVAILABLE=false
 373   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 374     AC_MSG_RESULT([no, does not work with Solaris Studio])
 375     PRECOMPILED_HEADERS_AVAILABLE=false
 376   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 377     AC_MSG_RESULT([no, does not work with xlc])
 378     PRECOMPILED_HEADERS_AVAILABLE=false
 379   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 380     # Check that the compiler actually supports precomp headers.
 381     echo "int alfa();" > conftest.h
 382     $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
 383     if test ! -f conftest.hpp.gch; then
 384       PRECOMPILED_HEADERS_AVAILABLE=false
 385       AC_MSG_RESULT([no, gcc fails to compile properly with -x c++-header])
 386     else
 387       AC_MSG_RESULT([yes])
 388     fi
 389     $RM conftest.h conftest.hpp.gch
 390   else
 391     AC_MSG_RESULT([yes])
 392   fi
 393 
 394   UTIL_ARG_ENABLE(NAME: precompiled-headers, DEFAULT: auto,


  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
  23 # questions.
  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     if test "$NUM_CORES" -eq "0"; then
  36       NUM_CORES=`cat /proc/cpuinfo  | grep -c ^CPU`
  37     fi
  38     if test "$NUM_CORES" -ne "0"; then
  39       FOUND_CORES=yes
  40     fi




  41   elif test -x /usr/sbin/sysctl; then
  42     # Looks like a MacOSX system
  43     NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
  44     FOUND_CORES=yes
  45   elif test "x$OPENJDK_BUILD_OS" = xaix ; then
  46     NUM_LCPU=`lparstat -m 2> /dev/null | $GREP -o "lcpu=[[0-9]]*" | $CUT -d "=" -f 2`
  47     if test -n "$NUM_LCPU"; then
  48       NUM_CORES=$NUM_LCPU
  49       FOUND_CORES=yes
  50     fi
  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 an AIX system
  79     MEMORY_SIZE=`/usr/sbin/prtconf 2> /dev/null | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
  80     FOUND_MEM=yes
  81   elif test -x /usr/sbin/sysctl; then
  82     # Looks like a MacOSX system
  83     MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
  84     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  85     FOUND_MEM=yes
  86   elif test "x$OPENJDK_BUILD_OS" = xwindows; then
  87     # Windows, but without cygwin
  88     MEMORY_SIZE=`wmic computersystem get totalphysicalmemory -value | grep = | cut -d "=" -f 2-`
  89     MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
  90     FOUND_MEM=yes
  91   fi
  92 
  93   if test "x$FOUND_MEM" = xyes; then
  94     AC_MSG_RESULT([$MEMORY_SIZE MB])
  95   else
  96     AC_MSG_RESULT([could not detect memory size, defaulting to $MEMORY_SIZE MB])
  97     AC_MSG_WARN([This might seriously impact build performance!])
  98   fi


 348       AC_MSG_CHECKING([for icecc build environment for build compiler])
 349       AC_MSG_RESULT([${ICECC_ENV_BUNDLE}])
 350       BUILD_ICECC="ICECC_VERSION=${ICECC_ENV_BUNDLE} ICECC_CC=${BUILD_CC} \
 351           ICECC_CXX=${BUILD_CXX} ${ICECC_CMD}"
 352     else
 353       BUILD_ICECC="${ICECC}"
 354     fi
 355   fi
 356 
 357   AC_SUBST(ICECC)
 358   AC_SUBST(BUILD_ICECC)
 359 ])
 360 
 361 AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
 362 [
 363   # Are precompiled headers available?
 364   PRECOMPILED_HEADERS_AVAILABLE=true
 365   AC_MSG_CHECKING([if precompiled headers are available])
 366   if test "x$ICECC" != "x"; then
 367     AC_MSG_RESULT([no, does not work effectively with icecc])



 368     PRECOMPILED_HEADERS_AVAILABLE=false
 369   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 370     AC_MSG_RESULT([no, does not work with xlc])
 371     PRECOMPILED_HEADERS_AVAILABLE=false
 372   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 373     # Check that the compiler actually supports precomp headers.
 374     echo "int alfa();" > conftest.h
 375     $CXX -x c++-header conftest.h -o conftest.hpp.gch 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
 376     if test ! -f conftest.hpp.gch; then
 377       PRECOMPILED_HEADERS_AVAILABLE=false
 378       AC_MSG_RESULT([no, gcc fails to compile properly with -x c++-header])
 379     else
 380       AC_MSG_RESULT([yes])
 381     fi
 382     $RM conftest.h conftest.hpp.gch
 383   else
 384     AC_MSG_RESULT([yes])
 385   fi
 386 
 387   UTIL_ARG_ENABLE(NAME: precompiled-headers, DEFAULT: auto,
< prev index next >