hotspot/src/share/vm/services/runtimeService.cpp
changeset 23443 15e8ed68f73a
parent 22796 bb0ea482a99e
child 27462 2fef16b8c70f
equal deleted inserted replaced
23442:be6bd2c1f2a8 23443:15e8ed68f73a
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    36 TimeStamp RuntimeService::_safepoint_timer;
    36 TimeStamp RuntimeService::_safepoint_timer;
    37 PerfCounter*  RuntimeService::_sync_time_ticks = NULL;
    37 PerfCounter*  RuntimeService::_sync_time_ticks = NULL;
    38 PerfCounter*  RuntimeService::_total_safepoints = NULL;
    38 PerfCounter*  RuntimeService::_total_safepoints = NULL;
    39 PerfCounter*  RuntimeService::_safepoint_time_ticks = NULL;
    39 PerfCounter*  RuntimeService::_safepoint_time_ticks = NULL;
    40 PerfCounter*  RuntimeService::_application_time_ticks = NULL;
    40 PerfCounter*  RuntimeService::_application_time_ticks = NULL;
    41 PerfCounter*  RuntimeService::_thread_interrupt_signaled_count = NULL;
       
    42 PerfCounter*  RuntimeService::_interrupted_before_count = NULL;
       
    43 PerfCounter*  RuntimeService::_interrupted_during_count = NULL;
       
    44 
    41 
    45 void RuntimeService::init() {
    42 void RuntimeService::init() {
    46   // Make sure the VM version is initialized
    43   // Make sure the VM version is initialized
    47   Abstract_VM_Version::initialize();
    44   Abstract_VM_Version::initialize();
    48 
    45 
    67 
    64 
    68 
    65 
    69     // create performance counters for jvm_version and its capabilities
    66     // create performance counters for jvm_version and its capabilities
    70     PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None,
    67     PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None,
    71                                      (jlong) Abstract_VM_Version::jvm_version(), CHECK);
    68                                      (jlong) Abstract_VM_Version::jvm_version(), CHECK);
    72 
       
    73     // I/O interruption related counters
       
    74 
       
    75     // thread signaling via os::interrupt()
       
    76 
       
    77     _thread_interrupt_signaled_count =
       
    78                 PerfDataManager::create_counter(SUN_RT,
       
    79                  "threadInterruptSignaled", PerfData::U_Events, CHECK);
       
    80 
       
    81     // OS_INTRPT via "check before" in _INTERRUPTIBLE
       
    82 
       
    83     _interrupted_before_count =
       
    84                 PerfDataManager::create_counter(SUN_RT, "interruptedBeforeIO",
       
    85                                                 PerfData::U_Events, CHECK);
       
    86 
       
    87     // OS_INTRPT via "check during" in _INTERRUPTIBLE
       
    88 
       
    89     _interrupted_during_count =
       
    90                 PerfDataManager::create_counter(SUN_RT, "interruptedDuringIO",
       
    91                                                 PerfData::U_Events, CHECK);
       
    92 
    69 
    93     // The capabilities counter is a binary representation of the VM capabilities in string.
    70     // The capabilities counter is a binary representation of the VM capabilities in string.
    94     // This string respresentation simplifies the implementation of the client side
    71     // This string respresentation simplifies the implementation of the client side
    95     // to parse the value.
    72     // to parse the value.
    96     char capabilities[65];
    73     char capabilities[65];
   179 jlong RuntimeService::application_time_ms() {
   156 jlong RuntimeService::application_time_ms() {
   180   return UsePerfData ?
   157   return UsePerfData ?
   181     Management::ticks_to_ms(_application_time_ticks->get_value()) : -1;
   158     Management::ticks_to_ms(_application_time_ticks->get_value()) : -1;
   182 }
   159 }
   183 
   160 
   184 void RuntimeService::record_interrupted_before_count() {
       
   185   if (UsePerfData) {
       
   186     _interrupted_before_count->inc();
       
   187   }
       
   188 }
       
   189 
       
   190 void RuntimeService::record_interrupted_during_count() {
       
   191   if (UsePerfData) {
       
   192     _interrupted_during_count->inc();
       
   193   }
       
   194 }
       
   195 
       
   196 void RuntimeService::record_thread_interrupt_signaled_count() {
       
   197   if (UsePerfData) {
       
   198     _thread_interrupt_signaled_count->inc();
       
   199   }
       
   200 }
       
   201 
       
   202 #endif // INCLUDE_MANAGEMENT
   161 #endif // INCLUDE_MANAGEMENT