< prev index next >

src/hotspot/share/runtime/perfData.cpp

Print this page




   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  */
  24 
  25 #include "precompiled.hpp"

  26 #include "classfile/vmSymbols.hpp"
  27 #include "logging/log.hpp"
  28 #include "oops/oop.inline.hpp"
  29 #include "prims/jvm.h"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/java.hpp"
  32 #include "runtime/mutex.hpp"
  33 #include "runtime/mutexLocker.hpp"
  34 #include "runtime/os.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "utilities/exceptions.hpp"
  37 #include "utilities/globalDefinitions.hpp"
  38 
  39 PerfDataList*   PerfDataManager::_all = NULL;
  40 PerfDataList*   PerfDataManager::_sampled = NULL;
  41 PerfDataList*   PerfDataManager::_constants = NULL;
  42 volatile bool   PerfDataManager::_has_PerfData = 0;
  43 
  44 /*
  45  * The jvmstat global and subsystem jvmstat counter name spaces. The top
  46  * level name spaces imply the interface stability level of the counter,
  47  * which generally follows the Java package, class, and property naming
  48  * conventions. The CounterNS enumeration values should be used to index
  49  * into this array.


 403 PerfLongConstant* PerfDataManager::create_long_constant(CounterNS ns,
 404                                                         const char* name,
 405                                                         PerfData::Units u,
 406                                                         jlong val, TRAPS) {
 407 
 408   PerfLongConstant* p = new PerfLongConstant(ns, name, u, val);
 409 
 410   if (!p->is_valid()) {
 411     // allocation of native resources failed.
 412     delete p;
 413     THROW_0(vmSymbols::java_lang_OutOfMemoryError());
 414   }
 415 
 416   add_item(p, false);
 417 
 418   return p;
 419 }
 420 
 421 PerfStringVariable* PerfDataManager::create_string_variable(CounterNS ns,
 422                                                             const char* name,
 423                                                             jint max_length,
 424                                                             const char* s,
 425                                                             TRAPS) {
 426 
 427   if (max_length == 0 && s != NULL) max_length = (jint)strlen(s);
 428 
 429   assert(max_length != 0, "PerfStringVariable with length 0");
 430 
 431   PerfStringVariable* p = new PerfStringVariable(ns, name, max_length, s);
 432 
 433   if (!p->is_valid()) {
 434     // allocation of native resources failed.
 435     delete p;
 436     THROW_0(vmSymbols::java_lang_OutOfMemoryError());
 437   }
 438 
 439   add_item(p, false);
 440 
 441   return p;
 442 }
 443 
 444 PerfLongVariable* PerfDataManager::create_long_variable(CounterNS ns,
 445                                                         const char* name,
 446                                                         PerfData::Units u,
 447                                                         jlong ival, TRAPS) {




   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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "logging/log.hpp"
  29 #include "oops/oop.inline.hpp"

  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/java.hpp"
  32 #include "runtime/mutex.hpp"
  33 #include "runtime/mutexLocker.hpp"
  34 #include "runtime/os.hpp"
  35 #include "runtime/perfData.hpp"
  36 #include "utilities/exceptions.hpp"
  37 #include "utilities/globalDefinitions.hpp"
  38 
  39 PerfDataList*   PerfDataManager::_all = NULL;
  40 PerfDataList*   PerfDataManager::_sampled = NULL;
  41 PerfDataList*   PerfDataManager::_constants = NULL;
  42 volatile bool   PerfDataManager::_has_PerfData = 0;
  43 
  44 /*
  45  * The jvmstat global and subsystem jvmstat counter name spaces. The top
  46  * level name spaces imply the interface stability level of the counter,
  47  * which generally follows the Java package, class, and property naming
  48  * conventions. The CounterNS enumeration values should be used to index
  49  * into this array.


 403 PerfLongConstant* PerfDataManager::create_long_constant(CounterNS ns,
 404                                                         const char* name,
 405                                                         PerfData::Units u,
 406                                                         jlong val, TRAPS) {
 407 
 408   PerfLongConstant* p = new PerfLongConstant(ns, name, u, val);
 409 
 410   if (!p->is_valid()) {
 411     // allocation of native resources failed.
 412     delete p;
 413     THROW_0(vmSymbols::java_lang_OutOfMemoryError());
 414   }
 415 
 416   add_item(p, false);
 417 
 418   return p;
 419 }
 420 
 421 PerfStringVariable* PerfDataManager::create_string_variable(CounterNS ns,
 422                                                             const char* name,
 423                                                             int max_length,
 424                                                             const char* s,
 425                                                             TRAPS) {
 426 
 427   if (max_length == 0 && s != NULL) max_length = (int)strlen(s);
 428 
 429   assert(max_length != 0, "PerfStringVariable with length 0");
 430 
 431   PerfStringVariable* p = new PerfStringVariable(ns, name, max_length, s);
 432 
 433   if (!p->is_valid()) {
 434     // allocation of native resources failed.
 435     delete p;
 436     THROW_0(vmSymbols::java_lang_OutOfMemoryError());
 437   }
 438 
 439   add_item(p, false);
 440 
 441   return p;
 442 }
 443 
 444 PerfLongVariable* PerfDataManager::create_long_variable(CounterNS ns,
 445                                                         const char* name,
 446                                                         PerfData::Units u,
 447                                                         jlong ival, TRAPS) {


< prev index next >