common/autoconf/cores.m4

Mon, 30 Apr 2012 12:13:29 -0700

author
ihse
date
Mon, 30 Apr 2012 12:13:29 -0700
changeset 430
afeeed8e5f8c
parent 425
e1830598f0b7
permissions
-rw-r--r--

7165277: Fix missing execute permission issue running logger.sh
Reviewed-by: ohair

ohair@425 1 #
ohair@425 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
ohair@425 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@425 4 #
ohair@425 5 # This code is free software; you can redistribute it and/or modify it
ohair@425 6 # under the terms of the GNU General Public License version 2 only, as
ohair@425 7 # published by the Free Software Foundation. Oracle designates this
ohair@425 8 # particular file as subject to the "Classpath" exception as provided
ohair@425 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@425 10 #
ohair@425 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@425 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@425 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@425 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@425 15 # accompanied this code).
ohair@425 16 #
ohair@425 17 # You should have received a copy of the GNU General Public License version
ohair@425 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@425 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@425 20 #
ohair@425 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@425 22 # or visit www.oracle.com if you need additional information or have any
ohair@425 23 # questions.
ohair@425 24 #
ohair@425 25
ohair@425 26 AC_DEFUN([CHECK_CORES],
ohair@425 27 [
ohair@425 28 AC_MSG_CHECKING([for number of cores])
ohair@425 29 NUM_CORES=1
ohair@425 30 FOUND_CORES=no
ohair@425 31
ohair@425 32 if test -f /proc/cpuinfo; then
ohair@425 33 # Looks like a Linux system
ohair@425 34 NUM_CORES=`cat /proc/cpuinfo | grep -c processor`
ohair@425 35 FOUND_CORES=yes
ohair@425 36 fi
ohair@425 37
ohair@425 38 if test -x /usr/sbin/psrinfo; then
ohair@425 39 # Looks like a Solaris system
ohair@425 40 NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
ohair@425 41 FOUND_CORES=yes
ohair@425 42 fi
ohair@425 43
ohair@425 44 if test -x /usr/sbin/system_profiler; then
ohair@425 45 # Looks like a MacOSX system
ohair@425 46 NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'`
ohair@425 47 FOUND_CORES=yes
ohair@425 48 fi
ohair@425 49
ohair@425 50 if test "x$build_os" = xwindows; then
ohair@425 51 NUM_CORES=4
ohair@425 52 fi
ohair@425 53
ohair@425 54 # For c/c++ code we run twice as many concurrent build
ohair@425 55 # jobs than we have cores, otherwise we will stall on io.
ohair@425 56 CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
ohair@425 57
ohair@425 58 if test "x$FOUND_CORES" = xyes; then
ohair@425 59 AC_MSG_RESULT([$NUM_CORES])
ohair@425 60 else
ohair@425 61 AC_MSG_RESULT([could not detect number of cores, defaulting to 1!])
ohair@425 62 fi
ohair@425 63
ohair@425 64 ])
ohair@425 65
ohair@425 66 AC_DEFUN([CHECK_MEMORY_SIZE],
ohair@425 67 [
ohair@425 68 AC_MSG_CHECKING([for memory size])
ohair@425 69 # Default to 1024MB
ohair@425 70 MEMORY_SIZE=1024
ohair@425 71 FOUND_MEM=no
ohair@425 72
ohair@425 73 if test -f /proc/cpuinfo; then
ohair@425 74 # Looks like a Linux system
ohair@425 75 MEMORY_SIZE=`cat /proc/meminfo | grep MemTotal | awk '{print [$]2}'`
ohair@425 76 MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
ohair@425 77 FOUND_MEM=yes
ohair@425 78 fi
ohair@425 79
ohair@425 80 if test -x /usr/sbin/prtconf; then
ohair@425 81 # Looks like a Solaris system
ohair@425 82 MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
ohair@425 83 FOUND_MEM=yes
ohair@425 84 fi
ohair@425 85
ohair@425 86 if test -x /usr/sbin/system_profiler; then
ohair@425 87 # Looks like a MacOSX system
ohair@425 88 MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print [$]2}'`
ohair@425 89 MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
ohair@425 90 FOUND_MEM=yes
ohair@425 91 fi
ohair@425 92
ohair@425 93 if test "x$build_os" = xwindows; then
ohair@425 94 MEMORY_SIZE=`systeminfo | grep 'Total Physical Memory:' | awk '{ print [$]4 }' | sed 's/,//'`
ohair@425 95 FOUND_MEM=yes
ohair@425 96 fi
ohair@425 97
ohair@425 98 if test "x$FOUND_MEM" = xyes; then
ohair@425 99 AC_MSG_RESULT([$MEMORY_SIZE MB])
ohair@425 100 else
ohair@425 101 AC_MSG_RESULT([could not detect memory size defaulting to 1024MB!])
ohair@425 102 fi
ohair@425 103 ])

mercurial