mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 01:24:33 +02:00
8275865: Print deoptimization statistics in product builds
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
bec977c778
commit
a343fa8766
2 changed files with 84 additions and 2 deletions
|
@ -230,7 +230,6 @@ void print_statistics() {
|
||||||
if ((PrintC1Statistics || LogVMOutput || LogCompilation) && UseCompiler) {
|
if ((PrintC1Statistics || LogVMOutput || LogCompilation) && UseCompiler) {
|
||||||
FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintC1Statistics);
|
FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintC1Statistics);
|
||||||
Runtime1::print_statistics();
|
Runtime1::print_statistics();
|
||||||
Deoptimization::print_statistics();
|
|
||||||
SharedRuntime::print_statistics();
|
SharedRuntime::print_statistics();
|
||||||
}
|
}
|
||||||
#endif /* COMPILER1 */
|
#endif /* COMPILER1 */
|
||||||
|
@ -239,8 +238,8 @@ void print_statistics() {
|
||||||
if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
|
if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
|
||||||
FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
|
FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
|
||||||
Compile::print_statistics();
|
Compile::print_statistics();
|
||||||
#ifndef COMPILER1
|
|
||||||
Deoptimization::print_statistics();
|
Deoptimization::print_statistics();
|
||||||
|
#ifndef COMPILER1
|
||||||
SharedRuntime::print_statistics();
|
SharedRuntime::print_statistics();
|
||||||
#endif //COMPILER1
|
#endif //COMPILER1
|
||||||
os::print_statistics();
|
os::print_statistics();
|
||||||
|
@ -352,6 +351,14 @@ void print_statistics() {
|
||||||
CompileBroker::print_times();
|
CompileBroker::print_times();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPILER2_OR_JVMCI
|
||||||
|
if ((LogVMOutput || LogCompilation) && UseCompiler) {
|
||||||
|
// Only print the statistics to the log file
|
||||||
|
FlagSetting fs(DisplayVMOutput, false);
|
||||||
|
Deoptimization::print_statistics();
|
||||||
|
}
|
||||||
|
#endif /* COMPILER2 || INCLUDE_JVMCI */
|
||||||
|
|
||||||
if (PrintCodeCache) {
|
if (PrintCodeCache) {
|
||||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||||
CodeCache::print();
|
CodeCache::print();
|
||||||
|
|
75
test/hotspot/jtreg/runtime/logging/DeoptStats.java
Normal file
75
test/hotspot/jtreg/runtime/logging/DeoptStats.java
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* Copyright Amazon.com Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8275865
|
||||||
|
* @requires vm.compiler2.enabled
|
||||||
|
* @summary Verify that the Deoptimization statistics are printed to the VM/Compiler log file
|
||||||
|
* @library /test/lib
|
||||||
|
* @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow
|
||||||
|
* -XX:-OmitStackTraceInFastThrow
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation
|
||||||
|
* -XX:-LogVMOutput -XX:LogFile=compilation.log DeoptStats
|
||||||
|
* @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow
|
||||||
|
* -XX:-OmitStackTraceInFastThrow
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation
|
||||||
|
* -XX:+LogVMOutput -XX:LogFile=vmOutput.log DeoptStats
|
||||||
|
* @run main/othervm DeoptStats compilation.log vmOutput.log
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
|
||||||
|
public class DeoptStats {
|
||||||
|
|
||||||
|
static class Value {
|
||||||
|
int i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int f(Value v) {
|
||||||
|
return v.i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void verify(String[] logFiles) throws Exception {
|
||||||
|
for (String logFile : logFiles) {
|
||||||
|
OutputAnalyzer oa = new OutputAnalyzer(Paths.get(logFile));
|
||||||
|
oa.shouldMatchByLine("<statistics type='deoptimization'>", // Start from this line
|
||||||
|
"</statistics>", // Match until this line
|
||||||
|
"(Deoptimization traps recorded:)|( .+)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
if (args.length > 0) {
|
||||||
|
verify(args);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
try {
|
||||||
|
f(null);
|
||||||
|
}
|
||||||
|
catch (NullPointerException npe) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue