mirror of https://github.com/oracle/graal.git
[GR-55172] Deprecate BuildOutputBreakdowns option
PullRequest: graal/18444
This commit is contained in:
commit
edbfec0c7d
|
@ -700,7 +700,7 @@ public class SubstrateOptions {
|
||||||
@Option(help = "Report progress in build output (default is adaptive)", type = OptionType.User)//
|
@Option(help = "Report progress in build output (default is adaptive)", type = OptionType.User)//
|
||||||
public static final HostedOptionKey<Boolean> BuildOutputProgress = new HostedOptionKey<>(false);
|
public static final HostedOptionKey<Boolean> BuildOutputProgress = new HostedOptionKey<>(false);
|
||||||
|
|
||||||
@Option(help = "Show code and heap breakdowns as part of the build output", type = OptionType.User)//
|
@Option(help = "Show code and heap breakdowns as part of the build output", type = OptionType.User, deprecated = true, deprecationMessage = "Deprecated without replacement")//
|
||||||
public static final HostedOptionKey<Boolean> BuildOutputBreakdowns = new HostedOptionKey<>(true);
|
public static final HostedOptionKey<Boolean> BuildOutputBreakdowns = new HostedOptionKey<>(true);
|
||||||
|
|
||||||
@Option(help = "Show recommendations as part of the build output", type = OptionType.User)//
|
@Option(help = "Show recommendations as part of the build output", type = OptionType.User)//
|
||||||
|
|
|
@ -81,11 +81,22 @@ public class HeapBreakdownProvider {
|
||||||
return sortedBreakdownEntries;
|
return sortedBreakdownEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBreakdownEntries(List<HeapBreakdownEntry> unsortedBreakdownEntries) {
|
||||||
|
assert this.sortedBreakdownEntries == null : "sortedBreakdownEntries were set before";
|
||||||
|
this.sortedBreakdownEntries = unsortedBreakdownEntries.stream().sorted(Comparator.comparingLong(HeapBreakdownEntry::getByteSize).reversed()).toList();
|
||||||
|
}
|
||||||
|
|
||||||
public long getTotalHeapSize() {
|
public long getTotalHeapSize() {
|
||||||
assert totalHeapSize >= 0;
|
assert totalHeapSize >= 0;
|
||||||
return totalHeapSize;
|
return totalHeapSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setTotalHeapSize(long totalHeapSize) {
|
||||||
|
assert this.totalHeapSize == -1 : "Total heap size was set before";
|
||||||
|
assert totalHeapSize >= 0 : "Invalid total heap size: " + totalHeapSize;
|
||||||
|
this.totalHeapSize = totalHeapSize;
|
||||||
|
}
|
||||||
|
|
||||||
protected void calculate(BeforeImageWriteAccessImpl access) {
|
protected void calculate(BeforeImageWriteAccessImpl access) {
|
||||||
HostedMetaAccess metaAccess = access.getHostedMetaAccess();
|
HostedMetaAccess metaAccess = access.getHostedMetaAccess();
|
||||||
ObjectLayout objectLayout = ImageSingletons.lookup(ObjectLayout.class);
|
ObjectLayout objectLayout = ImageSingletons.lookup(ObjectLayout.class);
|
||||||
|
@ -125,8 +136,8 @@ public class HeapBreakdownProvider {
|
||||||
classToDataMap.clear();
|
classToDataMap.clear();
|
||||||
|
|
||||||
/* Add heap alignment. */
|
/* Add heap alignment. */
|
||||||
totalHeapSize = access.getImage().getImageHeapSize();
|
setTotalHeapSize(access.getImage().getImageHeapSize());
|
||||||
long heapAlignmentSize = totalHeapSize - totalObjectSize;
|
long heapAlignmentSize = getTotalHeapSize() - totalObjectSize;
|
||||||
assert heapAlignmentSize >= 0 : "Incorrect heap alignment detected: " + heapAlignmentSize;
|
assert heapAlignmentSize >= 0 : "Incorrect heap alignment detected: " + heapAlignmentSize;
|
||||||
if (heapAlignmentSize > 0) {
|
if (heapAlignmentSize > 0) {
|
||||||
HeapBreakdownEntry heapAlignmentEntry = new HeapBreakdownEntry("", "heap alignment", "#glossary-heap-alignment");
|
HeapBreakdownEntry heapAlignmentEntry = new HeapBreakdownEntry("", "heap alignment", "#glossary-heap-alignment");
|
||||||
|
@ -177,7 +188,7 @@ public class HeapBreakdownProvider {
|
||||||
assert byteArrayEntry.byteSize >= 0 && byteArrayEntry.count >= 0;
|
assert byteArrayEntry.byteSize >= 0 && byteArrayEntry.count >= 0;
|
||||||
addEntry(entries, byteArrayEntry, new HeapBreakdownEntry(BYTE_ARRAY_PREFIX, "general heap data", "#glossary-general-heap-data"), byteArrayEntry.byteSize, byteArrayEntry.count);
|
addEntry(entries, byteArrayEntry, new HeapBreakdownEntry(BYTE_ARRAY_PREFIX, "general heap data", "#glossary-general-heap-data"), byteArrayEntry.byteSize, byteArrayEntry.count);
|
||||||
assert byteArrayEntry.byteSize == 0 && byteArrayEntry.count == 0;
|
assert byteArrayEntry.byteSize == 0 && byteArrayEntry.count == 0;
|
||||||
sortedBreakdownEntries = entries.stream().sorted(Comparator.comparingLong(HeapBreakdownEntry::getByteSize).reversed()).toList();
|
setBreakdownEntries(entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addEntry(List<HeapBreakdownEntry> entries, HeapBreakdownEntry byteArrayEntry, HeapBreakdownEntry newData, long byteSize, int count) {
|
private static void addEntry(List<HeapBreakdownEntry> entries, HeapBreakdownEntry byteArrayEntry, HeapBreakdownEntry newData, long byteSize, int count) {
|
||||||
|
@ -200,7 +211,7 @@ public class HeapBreakdownProvider {
|
||||||
long byteSize;
|
long byteSize;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
HeapBreakdownEntry(HostedClass hostedClass) {
|
public HeapBreakdownEntry(HostedClass hostedClass) {
|
||||||
this(hostedClass.toJavaName(true));
|
this(hostedClass.toJavaName(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,4 +364,8 @@ public class HostedConfiguration {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HeapBreakdownProvider createHeapBreakdownProvider() {
|
||||||
|
return new HeapBreakdownProvider();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ public class ProgressReporterFeature implements InternalFeature {
|
||||||
protected final ProgressReporter reporter = ProgressReporter.singleton();
|
protected final ProgressReporter reporter = ProgressReporter.singleton();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterRegistration(AfterRegistrationAccess access) {
|
public void duringSetup(DuringSetupAccess access) {
|
||||||
if (SubstrateOptions.BuildOutputBreakdowns.getValue()) {
|
if (SubstrateOptions.BuildOutputBreakdowns.getValue()) {
|
||||||
ImageSingletons.add(HeapBreakdownProvider.class, new HeapBreakdownProvider());
|
ImageSingletons.add(HeapBreakdownProvider.class, HostedConfiguration.instance().createHeapBreakdownProvider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue