jdk/src/solaris/bin/ergo_zero.c
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 4111 ffc9c33335f4
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4111
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
     2
 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
4111
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     4
 *
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4111
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4111
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    10
 *
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    15
 * accompanied this code).
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    16
 *
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4111
diff changeset
    23
 * questions.
4111
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    24
 */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    25
#include "ergo.h"
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    26
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    27
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    28
/* Methods for solaris-sparc and linux-sparc: these are easy. */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    29
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    30
/* Ask the OS how many processors there are. */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    31
static unsigned long
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    32
physical_processors(void) {
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    33
  const unsigned long sys_processors = sysconf(_SC_NPROCESSORS_CONF);
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    34
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    35
  JLI_TraceLauncher("sysconf(_SC_NPROCESSORS_CONF): %lu\n", sys_processors);
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    36
  return sys_processors;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    37
}
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    38
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    39
/* The sparc version of the "server-class" predicate. */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    40
jboolean
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    41
ServerClassMachineImpl(void) {
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    42
  jboolean            result            = JNI_FALSE;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    43
  /* How big is a server class machine? */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    44
  const unsigned long server_processors = 2UL;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    45
  const uint64_t      server_memory     = 2UL * GB;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    46
  const uint64_t      actual_memory     = physical_memory();
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    47
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    48
  /* Is this a server class machine? */
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    49
  if (actual_memory >= server_memory) {
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    50
    const unsigned long actual_processors = physical_processors();
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    51
    if (actual_processors >= server_processors) {
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    52
      result = JNI_TRUE;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    53
    }
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    54
  }
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    55
  JLI_TraceLauncher("unix_" LIBARCHNAME "_ServerClassMachine: %s\n",
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    56
           (result == JNI_TRUE ? "JNI_TRUE" : "JNI_FALSE"));
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    57
  return result;
ffc9c33335f4 6891677: java/build integrate zero assembler JDK changes
gbenson
parents:
diff changeset
    58
}