/* * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
/* * The jvmstat global and subsystem jvmstat counter name spaces. The top * level name spaces imply the interface stability level of the counter, * which generally follows the Java package, class, and property naming * conventions. The CounterNS enumeration values should be used to index * into this array.
*/ constchar* PerfDataManager::_name_spaces[] = { // top level name spaces "java", // stable and supported name space "com.sun", // unstable but supported name space "sun", // unstable and unsupported name space // subsystem name spaces "java.gc", // Garbage Collection name spaces "com.sun.gc", "sun.gc", "java.ci", // Compiler name spaces "com.sun.ci", "sun.ci", "java.cls", // Class Loader name spaces "com.sun.cls", "sun.cls", "java.rt", // Runtime name spaces "com.sun.rt", "sun.rt", "java.os", // Operating System name spaces "com.sun.os", "sun.os", "java.threads", // Threads System name spaces "com.sun.threads", "sun.threads", "java.property", // Java Property name spaces "com.sun.property", "sun.property", "",
};
PerfData::PerfData(CounterNS ns, constchar* name, Units u, Variability v)
: _name(NULL), _v(v), _u(u), _on_c_heap(false), _valuep(NULL) {
if (ns == NULL_NS) { // No prefix is added to counters with the NULL_NS namespace.
strcpy(_name, name); // set the F_Supported flag based on the counter name prefix. if (PerfDataManager::is_stable_supported(_name) ||
PerfDataManager::is_unstable_supported(_name)) {
_flags = F_Supported;
} else {
_flags = F_None;
}
} else {
sprintf(_name, "%s.%s", prefix, name); // set the F_Supported flag based on the given namespace. if (PerfDataManager::is_stable_supported(ns) ||
PerfDataManager::is_unstable_supported(ns)) {
_flags = F_Supported;
} else {
_flags = F_None;
}
}
}
// align size to assure allocation in units of 8 bytes int align = sizeof(jlong) - 1;
size = ((size + align) & ~align); char* psmp = PerfMemory::alloc(size);
if (psmp == NULL) { // out of PerfMemory memory resources. allocate on the C heap // to avoid vm termination.
psmp = NEW_C_HEAP_ARRAY(char, size, mtInternal);
_on_c_heap = true;
}
// compute the addresses for the name and data char* cname = psmp + sizeof(PerfDataEntry);
// data is in the last dsize*dlen bytes of the entry void* valuep = (void*) (psmp + data_start);
if (_all == NULL) // destroy already called, or initialization never happened return;
// Clear the flag before we free the PerfData counters. Thus begins // the race between this thread and another thread that has just // queried PerfDataManager::has_PerfData() and gotten back 'true'. // The hope is that the other thread will finish its PerfData // manipulation before we free the memory. The two alternatives are // 1) leak the PerfData memory or 2) do some form of synchronized // access or check before every PerfData operation.
_has_PerfData = false;
os::naked_short_sleep(1); // 1ms sleep to let other thread(s) run
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.