src/share/vm/services/runtimeService.cpp

Tue, 24 Jul 2012 10:51:00 -0700

author
twisti
date
Tue, 24 Jul 2012 10:51:00 -0700
changeset 3969
1d7922586cf6
parent 3202
436b4a3231bf
child 4165
fb19af007ffc
permissions
-rw-r--r--

7023639: JSR 292 method handle invocation needs a fast path for compiled code
6984705: JSR 292 method handle creation should not go through JNI
Summary: remove assembly code for JDK 7 chained method handles
Reviewed-by: jrose, twisti, kvn, mhaupt
Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>

     1 /*
     2  * Copyright (c) 2003, 2010, 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.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #include "precompiled.hpp"
    26 #include "classfile/classLoader.hpp"
    27 #include "services/attachListener.hpp"
    28 #include "services/management.hpp"
    29 #include "services/runtimeService.hpp"
    30 #include "utilities/dtrace.hpp"
    31 #include "utilities/exceptions.hpp"
    33 #ifndef USDT2
    34 HS_DTRACE_PROBE_DECL(hs_private, safepoint__begin);
    35 HS_DTRACE_PROBE_DECL(hs_private, safepoint__end);
    36 #endif /* !USDT2 */
    38 TimeStamp RuntimeService::_app_timer;
    39 TimeStamp RuntimeService::_safepoint_timer;
    40 PerfCounter*  RuntimeService::_sync_time_ticks = NULL;
    41 PerfCounter*  RuntimeService::_total_safepoints = NULL;
    42 PerfCounter*  RuntimeService::_safepoint_time_ticks = NULL;
    43 PerfCounter*  RuntimeService::_application_time_ticks = NULL;
    44 PerfCounter*  RuntimeService::_thread_interrupt_signaled_count = NULL;
    45 PerfCounter*  RuntimeService::_interrupted_before_count = NULL;
    46 PerfCounter*  RuntimeService::_interrupted_during_count = NULL;
    48 void RuntimeService::init() {
    49   // Make sure the VM version is initialized
    50   Abstract_VM_Version::initialize();
    52   if (UsePerfData) {
    53     EXCEPTION_MARK;
    55     _sync_time_ticks =
    56               PerfDataManager::create_counter(SUN_RT, "safepointSyncTime",
    57                                               PerfData::U_Ticks, CHECK);
    59     _total_safepoints =
    60               PerfDataManager::create_counter(SUN_RT, "safepoints",
    61                                               PerfData::U_Events, CHECK);
    63     _safepoint_time_ticks =
    64               PerfDataManager::create_counter(SUN_RT, "safepointTime",
    65                                               PerfData::U_Ticks, CHECK);
    67     _application_time_ticks =
    68               PerfDataManager::create_counter(SUN_RT, "applicationTime",
    69                                               PerfData::U_Ticks, CHECK);
    72     // create performance counters for jvm_version and its capabilities
    73     PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None,
    74                                      (jlong) Abstract_VM_Version::jvm_version(), CHECK);
    76     // I/O interruption related counters
    78     // thread signaling via os::interrupt()
    80     _thread_interrupt_signaled_count =
    81                 PerfDataManager::create_counter(SUN_RT,
    82                  "threadInterruptSignaled", PerfData::U_Events, CHECK);
    84     // OS_INTRPT via "check before" in _INTERRUPTIBLE
    86     _interrupted_before_count =
    87                 PerfDataManager::create_counter(SUN_RT, "interruptedBeforeIO",
    88                                                 PerfData::U_Events, CHECK);
    90     // OS_INTRPT via "check during" in _INTERRUPTIBLE
    92     _interrupted_during_count =
    93                 PerfDataManager::create_counter(SUN_RT, "interruptedDuringIO",
    94                                                 PerfData::U_Events, CHECK);
    96     // The capabilities counter is a binary representation of the VM capabilities in string.
    97     // This string respresentation simplifies the implementation of the client side
    98     // to parse the value.
    99     char capabilities[65];
   100     size_t len = sizeof(capabilities);
   101     memset((void*) capabilities, '0', len);
   102     capabilities[len-1] = '\0';
   103     capabilities[0] = AttachListener::is_attach_supported() ? '1' : '0';
   104 #ifdef KERNEL
   105     capabilities[1] = '1';
   106 #endif // KERNEL
   107     PerfDataManager::create_string_constant(SUN_RT, "jvmCapabilities",
   108                                             capabilities, CHECK);
   109   }
   110 }
   112 void RuntimeService::record_safepoint_begin() {
   113 #ifndef USDT2
   114   HS_DTRACE_PROBE(hs_private, safepoint__begin);
   115 #else /* USDT2 */
   116   HS_PRIVATE_SAFEPOINT_BEGIN();
   117 #endif /* USDT2 */
   119   // Print the time interval in which the app was executing
   120   if (PrintGCApplicationConcurrentTime) {
   121     gclog_or_tty->print_cr("Application time: %3.7f seconds",
   122                                 last_application_time_sec());
   123   }
   125   // update the time stamp to begin recording safepoint time
   126   _safepoint_timer.update();
   127   if (UsePerfData) {
   128     _total_safepoints->inc();
   129     if (_app_timer.is_updated()) {
   130       _application_time_ticks->inc(_app_timer.ticks_since_update());
   131     }
   132   }
   133 }
   135 void RuntimeService::record_safepoint_synchronized() {
   136   if (UsePerfData) {
   137     _sync_time_ticks->inc(_safepoint_timer.ticks_since_update());
   138   }
   139 }
   141 void RuntimeService::record_safepoint_end() {
   142 #ifndef USDT2
   143   HS_DTRACE_PROBE(hs_private, safepoint__end);
   144 #else /* USDT2 */
   145   HS_PRIVATE_SAFEPOINT_END();
   146 #endif /* USDT2 */
   148   // Print the time interval for which the app was stopped
   149   // during the current safepoint operation.
   150   if (PrintGCApplicationStoppedTime) {
   151     gclog_or_tty->print_cr("Total time for which application threads "
   152                            "were stopped: %3.7f seconds",
   153                            last_safepoint_time_sec());
   154   }
   156   // update the time stamp to begin recording app time
   157   _app_timer.update();
   158   if (UsePerfData) {
   159     _safepoint_time_ticks->inc(_safepoint_timer.ticks_since_update());
   160   }
   161 }
   163 void RuntimeService::record_application_start() {
   164   // update the time stamp to begin recording app time
   165   _app_timer.update();
   166 }
   168 // Don't need to record application end because we currently
   169 // exit at a safepoint and record_safepoint_begin() handles updating
   170 // the application time counter at VM exit.
   172 jlong RuntimeService::safepoint_sync_time_ms() {
   173   return UsePerfData ?
   174     Management::ticks_to_ms(_sync_time_ticks->get_value()) : -1;
   175 }
   177 jlong RuntimeService::safepoint_count() {
   178   return UsePerfData ?
   179     _total_safepoints->get_value() : -1;
   180 }
   181 jlong RuntimeService::safepoint_time_ms() {
   182   return UsePerfData ?
   183     Management::ticks_to_ms(_safepoint_time_ticks->get_value()) : -1;
   184 }
   186 jlong RuntimeService::application_time_ms() {
   187   return UsePerfData ?
   188     Management::ticks_to_ms(_application_time_ticks->get_value()) : -1;
   189 }
   191 void RuntimeService::record_interrupted_before_count() {
   192   if (UsePerfData) {
   193     _interrupted_before_count->inc();
   194   }
   195 }
   197 void RuntimeService::record_interrupted_during_count() {
   198   if (UsePerfData) {
   199     _interrupted_during_count->inc();
   200   }
   201 }
   203 void RuntimeService::record_thread_interrupt_signaled_count() {
   204   if (UsePerfData) {
   205     _thread_interrupt_signaled_count->inc();
   206   }
   207 }

mercurial