8328341: Remove deprecated per-thread compiler stats in sun.management

Reviewed-by: kevinw
This commit is contained in:
Eirik Bjørsnøs 2024-03-19 16:31:18 +00:00
parent 132921683b
commit 9214a62f26
3 changed files with 2 additions and 149 deletions

View File

@ -1,92 +0,0 @@
/*
* Copyright (c) 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package sun.management;
/**
*/
@Deprecated
public class CompilerThreadStat implements java.io.Serializable {
private String name;
private long taskCount;
private long compileTime;
private MethodInfo lastMethod;
CompilerThreadStat(String name, long taskCount, long time, MethodInfo lastMethod) {
this.name = name;
this.taskCount = taskCount;
this.compileTime = time;
this.lastMethod = lastMethod;
};
/**
* Returns the name of the compiler thread associated with
* this compiler thread statistic.
*
* @return the name of the compiler thread.
*/
public String getName() {
return name;
}
/**
* Returns the number of compile tasks performed by the compiler thread
* associated with this compiler thread statistic.
*
* @return the number of compile tasks performed by the compiler thread.
*/
public long getCompileTaskCount() {
return taskCount;
}
/**
* Returns the accumulated elapsed time spent by the compiler thread
* associated with this compiler thread statistic.
*
* @return the accumulated elapsed time spent by the compiler thread.
*/
public long getCompileTime() {
return compileTime;
}
/**
* Returns the information about the last method compiled by
* the compiler thread associated with this compiler thread statistic.
*
* @return a {@link MethodInfo} object for the last method
* compiled by the compiler thread.
*/
public MethodInfo getLastCompiledMethodInfo() {
return lastMethod;
}
public String toString() {
return getName() + " compileTasks = " + getCompileTaskCount()
+ " compileTime = " + getCompileTime();
}
private static final long serialVersionUID = 6992337162326171013L;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
@ -72,33 +72,6 @@ class HotspotCompilation
private StringCounter lastInvalidatedMethod;
private LongCounter lastInvalidatedType;
private class CompilerThreadInfo {
String name;
StringCounter method;
LongCounter type;
LongCounter compiles;
LongCounter time;
CompilerThreadInfo(String bname, int index) {
String basename = bname + "." + index + ".";
this.name = bname + "-" + index;
this.method = (StringCounter) lookup(basename + "method");
this.type = (LongCounter) lookup(basename + "type");
this.compiles = (LongCounter) lookup(basename + "compiles");
this.time = (LongCounter) lookup(basename + "time");
}
@SuppressWarnings("deprecation")
CompilerThreadStat getCompilerThreadStat() {
MethodInfo minfo = new MethodInfo(method.stringValue(),
(int) type.longValue(),
-1);
return new CompilerThreadStat(name,
compiles.longValue(),
time.longValue(),
minfo);
}
}
private List<CompilerThreadInfo> threads;
private int numActiveThreads; // number of active compiler threads
private Map<String, Counter> counters;
@ -145,15 +118,6 @@ class HotspotCompilation
lastInvalidatedType = (LongCounter) lookup("lastInvalidatedType");
numActiveThreads = (int) compilerThreads.longValue();
// Allocate CompilerThreadInfo for compilerThread and adaptorThread
threads = new ArrayList<>();
for (int i = 0; i < numActiveThreads; i++) {
if (counters.containsKey(SUN_CI + "compilerThread." + i + ".method")) {
threads.add(new CompilerThreadInfo("compilerThread", i));
}
}
}
public int getCompilerThreadCount() {
@ -180,15 +144,6 @@ class HotspotCompilation
return nmethodSize.longValue();
}
@Deprecated
public List<CompilerThreadStat> getCompilerThreadStats() {
List<CompilerThreadStat> list = new ArrayList<>(threads.size());
for (CompilerThreadInfo info : threads) {
list.add(info.getCompilerThreadStat());
}
return list;
}
public MethodInfo getLastCompile() {
return new MethodInfo(lastMethod.stringValue(),
(int) lastType.longValue(),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
@ -39,16 +39,6 @@ public interface HotspotCompilationMBean {
*/
public int getCompilerThreadCount();
/**
* Returns the statistic of all compiler threads.
*
* @return a list of {@link CompilerThreadStat} object containing
* the statistic of a compiler thread.
*
*/
@Deprecated
public java.util.List<CompilerThreadStat> getCompilerThreadStats();
/**
* Returns the total number of compiles.
*