-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PullRequest: graal/5982
- vscode-20.3.0
- vm-ee-24.1.1
- vm-ee-24.1.0
- vm-ee-24.0.2
- vm-ee-24.0.1
- vm-ee-24.0.0
- vm-ee-23.1.5
- vm-ee-23.1.4
- vm-ee-23.1.3
- vm-ee-23.1.2
- vm-ee-23.1.1
- vm-ee-23.1.0
- vm-ee-23.0.6
- vm-ee-23.0.5
- vm-ee-23.0.4
- vm-ee-23.0.3
- vm-ee-23.0.2
- vm-ee-23.0.1
- vm-ee-23.0.0
- vm-ee-22.3.3
- vm-ee-22.3.2
- vm-ee-22.3.0
- vm-ee-22.2.0.1
- vm-ee-22.2.0
- vm-ee-22.1.0
- vm-ee-22.0.0.2
- vm-ee-22.0.0.1
- vm-ee-22.0.0
- vm-ee-21.3.12
- vm-ee-21.3.11
- vm-ee-21.3.10
- vm-ee-21.3.9
- vm-ee-21.3.8
- vm-ee-21.3.7
- vm-ee-21.3.6
- vm-ee-21.3.4
- vm-ee-21.3.3.1
- vm-ee-21.3.3
- vm-ee-21.3.0
- vm-ee-21.2.0
- vm-ee-20.3.16
- vm-ee-20.3.15
- vm-ee-20.3.14
- vm-ee-20.3.13
- vm-ee-20.3.12
- vm-ee-20.3.11
- vm-ee-20.3.10
- vm-ee-20.3.8
- vm-ee-20.3.7.1
- vm-ee-20.3.7
- vm-ce-24.0.2
- vm-ce-24.0.1
- vm-ce-23.1.2
- vm-ce-23.1.1
- vm-ce-23.0.2
- vm-ce-23.0.1
- vm-ce-23.0.0
- vm-ce-22.3.3
- vm-ce-22.3.2
- vm-ce-22.3.1.1
- vm-ce-22.3.1
- vm-ce-22.3.0
- vm-ce-22.2.0.1
- vm-ce-22.2.0
- vm-ce-22.1.0.1
- vm-ce-22.1.0
- vm-ce-22.0.0.2
- vm-ce-22.0.0.1
- vm-ce-22.0.0
- vm-ce-21.3.6
- vm-ce-21.3.5
- vm-ce-21.3.4
- vm-ce-21.3.3.1
- vm-ce-21.3.3
- vm-ce-21.3.2.1
- vm-ce-21.3.2
- vm-ce-21.3.1
- vm-ce-21.3.0
- vm-ce-21.2.0
- vm-ce-20.3.10
- vm-ce-20.3.9
- vm-ce-20.3.8
- vm-ce-20.3.7.1
- vm-ce-20.3.6.1
- vm-ce-20.3.6
- vm-24.1.1
- vm-24.1.0
- vm-24.0.2
- vm-24.0.1
- vm-24.0.0
- vm-23.1.5
- vm-23.1.4
- vm-23.1.3
- vm-23.1.2
- vm-23.1.1
- vm-23.1.0
- vm-23.0.6
- vm-23.0.5
- vm-23.0.4
- vm-23.0.3
- vm-23.0.2
- vm-23.0.1
- vm-23.0.0
- vm-22.3.3
- vm-22.3.2
- vm-22.3.1.1
- vm-22.3.1
- vm-22.3.0
- vm-22.2.0.1
- vm-22.2.0
- vm-22.1.0.1
- vm-22.1.0
- vm-22.0.0.2
- vm-22.0.0.1
- vm-22.0.0
- vm-21.3.12
- vm-21.3.11
- vm-21.3.10
- vm-21.3.6
- vm-21.3.5
- vm-21.3.4
- vm-21.3.3.1
- vm-21.3.3
- vm-21.3.2.1
- vm-21.3.2
- vm-21.3.1
- vm-21.3.0
- vm-21.2.0.1
- vm-21.2.0
- vm-21.1.0
- vm-21.0.0.2
- vm-21.0.0.1
- vm-21.0.0
- vm-20.3.16
- vm-20.3.15
- vm-20.3.14
- vm-20.3.10
- vm-20.3.9
- vm-20.3.8
- vm-20.3.7.1
- vm-20.3.6.1
- vm-20.3.6
- vm-20.3.5
- vm-20.3.4
- vm-20.3.3
- vm-20.3.2
- vm-20.3.1.2
- vm-20.3.1.1
- vm-20.3.1
- vm-20.3.0
- vm-20.2.0
- jdk-25+3
- jdk-25+2
- jdk-25+1
- jdk-25+0
- jdk-24+29
- jdk-24+28
- jdk-24+27
- jdk-24+26
- jdk-24+25
- jdk-24+24
- jdk-24+23
- jdk-24+22
- jdk-24+21
- jdk-24+20
- jdk-24+19
- jdk-24+18
- jdk-24+17
- jdk-24+16
- jdk-24+15
- jdk-24+14
- jdk-24+13
- jdk-24+12
- jdk-24+11
- jdk-24+10
- jdk-24+9
- jdk-24+8
- jdk-24+7
- jdk-24+6
- jdk-24+5
- jdk-24+4
- jdk-24+3
- jdk-24+2
- jdk-24+1
- jdk-24.0.1+0
- jdk-24+0
- jdk-23+28
- jdk-23+27
- jdk-23+26
- jdk-23+25
- jdk-23+24
- jdk-23.0.1
- jdk-23.0.0
- jdk-22.0.2
- jdk-22.0.1
- jdk-22.0.0
- jdk-21.0.5
- jdk-21.0.2
- jdk-21.0.1
- jdk-21.0.0
- jdk-20.0.2
- jdk-20.0.1
- jdk-17.0.13
- jdk-17.0.12
- jdk-17.0.11
- jdk-17.0.10
- jdk-17.0.9
- jdk-17.0.8
- jdk-17.0.7
- jdk-11.0.25
- jdk-11.0.20
- jdk8u431
- graal-24.1.1
- graal-24.1.0
- graal-24.0.2
- graal-24.0.1
- graal-24.0.0
- graal-23.1.5
- graal-23.1.4
- graal-23.1.3
- graal-23.1.2
- graal-23.1.1
- graal-23.1.0
- graal-23.0.6
- graal-23.0.5
- graal-23.0.4
- graal-23.0.3
- graal-23.0.2
- graal-23.0.1
- graal-23.0.0
- graal-22.3.3
- graal-21.3.12
- graal-20.3.16
- JDK-8247922
- JDK-8243380
- 1.0.0
Showing
6 changed files
with
1,033 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...vm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/CodeBreakdownDumper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) 2020, 2020, 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 com.oracle.svm.hosted.dashboard; | ||
|
||
import com.oracle.shadowed.com.google.gson.JsonArray; | ||
import com.oracle.svm.hosted.FeatureImpl; | ||
import com.oracle.svm.hosted.code.CompileQueue; | ||
import com.oracle.svm.hosted.meta.HostedMethod; | ||
import org.graalvm.nativeimage.hosted.Feature; | ||
|
||
import com.oracle.shadowed.com.google.gson.JsonObject; | ||
|
||
import java.util.Collection; | ||
|
||
class CodeBreakdownDumper { | ||
|
||
JsonObject dump(Feature.AfterCompilationAccess access) { | ||
FeatureImpl.AfterCompilationAccessImpl config = (FeatureImpl.AfterCompilationAccessImpl) access; | ||
final Collection<CompileQueue.CompileTask> compilationTasks = config.getCompilationTasks(); | ||
JsonArray methodInfos = new JsonArray(compilationTasks.size()); | ||
for (CompileQueue.CompileTask task : compilationTasks) { | ||
JsonObject methodInfo = new JsonObject(); | ||
final HostedMethod method = task.method; | ||
final int targetSize = task.result.getTargetCodeSize(); | ||
methodInfo.addProperty("name", method.format("%H.%n(%p) %r")); | ||
methodInfo.addProperty("size", targetSize); | ||
methodInfos.add(methodInfo); | ||
} | ||
final JsonObject breakdown = new JsonObject(); | ||
breakdown.add("code-size", methodInfos); | ||
return breakdown; | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
...m/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/DashboardDumpFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright (c) 2020, 2020, 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 com.oracle.svm.hosted.dashboard; | ||
|
||
import com.oracle.graal.pointsto.reports.ReportUtils; | ||
import com.oracle.shadowed.com.google.gson.Gson; | ||
import com.oracle.shadowed.com.google.gson.GsonBuilder; | ||
import com.oracle.shadowed.com.google.gson.JsonObject; | ||
import org.graalvm.nativeimage.hosted.Feature; | ||
|
||
import com.oracle.svm.core.annotate.AutomaticFeature; | ||
|
||
import java.io.File; | ||
|
||
@AutomaticFeature | ||
public class DashboardDumpFeature implements Feature { | ||
private static boolean isHeapBreakdownDumped() { | ||
return DashboardOptions.DashboardAll.getValue() || DashboardOptions.DashboardHeap.getValue(); | ||
} | ||
|
||
private static boolean isPointsToDumped() { | ||
return DashboardOptions.DashboardAll.getValue() || DashboardOptions.DashboardPointsTo.getValue(); | ||
} | ||
|
||
private static boolean isCodeBreakdownDumped() { | ||
return DashboardOptions.DashboardAll.getValue() || DashboardOptions.DashboardCode.getValue(); | ||
} | ||
|
||
private static void dumpToFile(String dumpContent, String dumpPath) { | ||
final File file = new File(dumpPath).getAbsoluteFile(); | ||
ReportUtils.report("Dashboard dump output", file.toPath(), writer -> writer.write(dumpContent)); | ||
} | ||
|
||
private final JsonObject dumpRoot; | ||
|
||
public DashboardDumpFeature() { | ||
dumpRoot = new JsonObject(); | ||
} | ||
|
||
@Override | ||
public boolean isInConfiguration(IsInConfigurationAccess access) { | ||
return DashboardOptions.DashboardDump.getValue() != null; | ||
} | ||
|
||
@Override | ||
public void onAnalysisExit(OnAnalysisExitAccess access) { | ||
if (isPointsToDumped()) { | ||
final PointsToDumper pointsToDumper = new PointsToDumper(); | ||
final JsonObject pointsTo = pointsToDumper.dump(access); | ||
dumpRoot.add("points-to", pointsTo); | ||
} | ||
} | ||
|
||
@Override | ||
public void afterCompilation(AfterCompilationAccess access) { | ||
if (isCodeBreakdownDumped()) { | ||
final CodeBreakdownDumper codeBreakdownDumper = new CodeBreakdownDumper(); | ||
final JsonObject breakdown = codeBreakdownDumper.dump(access); | ||
dumpRoot.add("code-breakdown", breakdown); | ||
} | ||
} | ||
|
||
@Override | ||
public void afterHeapLayout(AfterHeapLayoutAccess access) { | ||
if (isHeapBreakdownDumped()) { | ||
final HeapBreakdownDumper heapBreakdownDumper = new HeapBreakdownDumper(); | ||
final JsonObject breakdown = heapBreakdownDumper.dump(access); | ||
dumpRoot.add("heap-breakdown", breakdown); | ||
} | ||
} | ||
|
||
@Override | ||
public void cleanup() { | ||
Gson gson = new GsonBuilder().setPrettyPrinting().create(); | ||
final String dump = gson.toJson(dumpRoot); | ||
dumpToFile(dump, DashboardOptions.DashboardDump.getValue()); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...atevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/DashboardOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2020, 2020, 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 com.oracle.svm.hosted.dashboard; | ||
|
||
import com.oracle.svm.core.option.HostedOptionKey; | ||
import org.graalvm.compiler.options.Option; | ||
import org.graalvm.compiler.options.OptionType; | ||
|
||
class DashboardOptions { | ||
@Option(help = "Enable dashboard dumps to the specified file.", type = OptionType.Expert)// | ||
static final HostedOptionKey<String> DashboardDump = new HostedOptionKey<>(null); | ||
|
||
@Option(help = "In the dashboard dump, include all available information about the native image (this takes precedence over more specific flags).", type = OptionType.Expert)// | ||
static final HostedOptionKey<Boolean> DashboardAll = new HostedOptionKey<>(false); | ||
|
||
@Option(help = "In the dashboard dump, include the breakdown of the object sizes in the heap across different classes.", type = OptionType.Expert)// | ||
static final HostedOptionKey<Boolean> DashboardHeap = new HostedOptionKey<>(false); | ||
|
||
@Option(help = "In the dashboard dump, include the breakdown of the code size across different packages.", type = OptionType.Expert)// | ||
static final HostedOptionKey<Boolean> DashboardCode = new HostedOptionKey<>(false); | ||
|
||
@Option(help = "In the dashboard dump, include the information about the points-to analysis.", type = OptionType.Expert)// | ||
static final HostedOptionKey<Boolean> DashboardPointsTo = new HostedOptionKey<>(false); | ||
} |
75 changes: 75 additions & 0 deletions
75
...vm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/HeapBreakdownDumper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (c) 2020, 2020, 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 com.oracle.svm.hosted.dashboard; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.graalvm.nativeimage.hosted.Feature; | ||
|
||
import com.oracle.shadowed.com.google.gson.JsonArray; | ||
import com.oracle.shadowed.com.google.gson.JsonObject; | ||
import com.oracle.shadowed.com.google.gson.JsonPrimitive; | ||
import com.oracle.svm.hosted.FeatureImpl; | ||
import com.oracle.svm.hosted.image.NativeImageHeap; | ||
|
||
class HeapBreakdownDumper { | ||
private class Statistics { | ||
long size = 0; | ||
long count = 0; | ||
} | ||
|
||
JsonObject dump(Feature.AfterHeapLayoutAccess access) { | ||
// Create the size histogram. | ||
FeatureImpl.AfterHeapLayoutAccessImpl config = (FeatureImpl.AfterHeapLayoutAccessImpl) access; | ||
NativeImageHeap heap = config.getHeap(); | ||
final HashMap<String, Statistics> sizes = new HashMap<>(); | ||
for (NativeImageHeap.ObjectInfo info : heap.getObjects()) { | ||
final String className = info.getClazz().getName(); | ||
Statistics stats = sizes.get(className); | ||
if (stats == null) { | ||
stats = new Statistics(); | ||
sizes.put(className, stats); | ||
} | ||
stats.size += info.getSize(); | ||
stats.count += 1; | ||
} | ||
|
||
// Create JSON data. | ||
JsonArray classInfos = new JsonArray(); | ||
for (Map.Entry<String, Statistics> entry : sizes.entrySet()) { | ||
final String className = entry.getKey(); | ||
final Statistics stats = entry.getValue(); | ||
JsonObject classInfo = new JsonObject(); | ||
classInfo.add("name", new JsonPrimitive(className)); | ||
classInfo.add("size", new JsonPrimitive(stats.size)); | ||
classInfo.add("count", new JsonPrimitive(stats.count)); | ||
classInfos.add(classInfo); | ||
} | ||
JsonObject root = new JsonObject(); | ||
root.add("heap-size", classInfos); | ||
return root; | ||
} | ||
} |
749 changes: 749 additions & 0 deletions
749
...tratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/dashboard/PointsToDumper.java
Large diffs are not rendered by default.
Oops, something went wrong.