553N/A * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 553N/A * published by the Free Software Foundation. 553N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// -------------------------------------------------------- 0N/A//---------------------------------------------------------- 0N/A// Implementation of StatSampler 0N/A * the initialize method is called from the engage() method 0N/A * and is responsible for initializing various global variables. 0N/A // create performance data that could not be created prior 0N/A // to vm_init_globals() or otherwise have no logical home. 0N/A // get copy of the sampled list 0N/A * The engage() method is called at initialization time via 0N/A * Thread::create_vm() to initialize the StatSampler and 0N/A * register it with the WatcherThread as a periodic task. 0N/A // start up the periodic task 0N/A * the disengage() method is responsible for deactivating the periodic 0N/A * task and, if logging was enabled, for logging the final sample. This 0N/A * method is called from before_exit() in java.cpp and is only called 0N/A * after the WatcherThread has been stopped. 0N/A // remove StatSamplerTask 0N/A // force a final sample 0N/A * the destroy method is responsible for releasing any resources used by 0N/A * the StatSampler prior to shutdown of the VM. this method is called from 0N/A * before_exit() in java.cpp and is only called after the WatcherThread 0N/A * The sample_data() method is responsible for sampling the 0N/A * the data value for each PerfData instance in the given list. 0N/A * the collect_sample() method is the method invoked by the * WatcherThread via the PeriodicTask::task() method. This method * is responsible for collecting data samples from sampled * PerfData instances every PerfDataSamplingInterval milliseconds. * It is also responsible for logging the requested set of * PerfData instances every _sample_count milliseconds. While * logging data, it will output a column header after every _print_header * rows of data have been logged. // future - check for new PerfData objects. PerfData objects might // get added to the PerfDataManager lists after we have already // built our local copies. // if (PerfDataManager::count() > previous) { // // get a new copy of the sampled list // if (_sampled != NULL) { // _sampled = PerfDataManager::sampled(); * method to upcall into Java to return the value of the specified * property as a utf8 string, or NULL if does not exist. The caller * is responsible for setting a ResourceMark for proper cleanup of // setup the arguments to getProperty // public static String getProperty(String key, String def); // convert Java String to utf8 string * The list of System Properties that have corresponding PerfData * string instrumentation created by retrieving the named property's * value from System.getProperty() and unconditionally creating a * PerfStringConstant object initialized to the retreived value. This * is not an exhustive list of Java properties with corresponding string * instrumentation as the create_system_property_instrumentation() method * creates other property based instrumentation conditionally. // stable interface, supported counters // unstable interface, supported counters // unstable interface, unsupported counters * Method to create PerfData string instruments that contain the values * of various system properties. String instruments are created for each * property specified in the property lists provided in property_counters[]. * Property counters have a counter name space prefix prepended to the * property name as indicated in property_counters[]. // the property must exist // create the property counter * The create_misc_perfdata() method provides a place to create * PerfData instances that would otherwise have no better place // frequency of the native high resolution timer // create string instrumentation for various Java properties. // hotspot flags (from .hotspotrc) and args (from command line) // java class name/jar file and arguments to main class // the Java VM Internal version string // create sampled instrumentation objects * helper class to provide for sampling of the elapsed_counter value * maintained in the OS class. * the create_sampled_perdata() method provides a place to instantiate * sampled PerfData instances that would otherwise have no better place // setup sampling of the elapsed time counter maintained in the // the os class. This counter can be used as either a time stamp // for each logged entry or as a liveness indicator for the VM. * the statSampler_exit() function is called from os_init.cpp on