perfMemory.cpp revision 3863
1879N/A * Copyright (c) 2001, 2010, 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 0N/A * published by the Free Software Foundation. 0N/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. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 434N/A// Prefix of performance data file. 434N/A// Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating 434N/A// character will be included in the sizeof(PERFDATA_NAME) operation. 0N/A // if the StatSampler is active, then we don't want to remove 0N/A // resources it may be dependent on. Typically, the StatSampler 0N/A // is disengaged from the watcher thread when this method is called, 0N/A // but it is not disengaged if this method is invoked during a 0N/A // remove the persistent external resources, if any. this method 0N/A // does not unmap or invalidate any virtual memory allocated during 0N/A // initialization already performed 0N/A // allocate PerfData memory region 0N/A // the PerfMemory region could not be created as desired. Rather 0N/A // than terminating the JVM, we revert to creating the instrumentation 0N/A // on the C heap. When running in this mode, external monitoring 0N/A // clients cannot attach to and monitor this JVM. 0N/A // the warning is issued only in debug mode in order to avoid 0N/A // additional output to the stdout or stderr output streams. 0N/A warning(
"Could not create PerfData Memory region, reverting to malloc");
0N/A // the PerfMemory region was created as expected. 0N/A // This state indicates that the contiguous memory region exists and 0N/A // that it wasn't large enough to hold all the counters. In this case, 0N/A // we output a warning message to the user on exit if the -XX:+Verbose 0N/A // flag is set (a debug only flag). External monitoring tools can detect 0N/A // this condition by monitoring the _prologue->overflow word. 0N/A // There are two tunables that can help resolve this issue: 0N/A // - increase the size of the PerfMemory with -XX:PerfDataMemorySize=<n> 0N/A // - decrease the maximum string constant length with 0N/A // -XX:PerfMaxStringConstLength=<n> 0N/A "\n\tUse -XX:PerfDataMemorySize=<size> to specify larger size.",
0N/A // this state indicates that the contiguous memory region was successfully 0N/A // and that persistent resources may need to be cleaned up. This is 0N/A // expected to be the typical condition. 0N/A// allocate an aligned block of memory from the PerfData memory 0N/A// region. This method assumes that the PerfData memory region 0N/A// was aligned on a double word boundary when created. 0N/A // check that there is enough memory for this request 0N/A// Returns the complete path including the file name of performance data file. 0N/A// Caller is expected to release the allocated memory. 0N/A // dest_file_name stores the validated file name if file_name 0N/A // contains %p which will be replaced by pid. 0N/A warning(
"Invalid performance data file path name specified, "\
0N/A "fall back to a default name");
0N/A // create the name of the file for retaining the instrumentation memory.