|
52 | 52 | import java.util.stream.Collectors;
|
53 | 53 | import java.util.stream.Stream;
|
54 | 54 |
|
| 55 | +import com.oracle.svm.core.configure.ConditionalRuntimeValue; |
| 56 | +import com.oracle.svm.core.jdk.resources.ResourceStorageEntryBase; |
55 | 57 | import org.graalvm.nativeimage.ImageSingletons;
|
56 | 58 | import org.graalvm.nativeimage.hosted.Feature;
|
57 | 59 | import org.graalvm.nativeimage.impl.ImageSingletonsSupport;
|
|
109 | 111 | import jdk.graal.compiler.options.OptionStability;
|
110 | 112 | import jdk.graal.compiler.options.OptionValues;
|
111 | 113 | import jdk.graal.compiler.util.json.JsonWriter;
|
| 114 | +import org.graalvm.nativeimage.impl.RuntimeResourceSupport; |
112 | 115 |
|
113 | 116 | @SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
|
114 | 117 | public class ProgressReporter {
|
@@ -506,10 +509,24 @@ private void printAnalysisStatistics(AnalysisUniverse universe, Collection<Strin
|
506 | 509 | String stubsFormat = "%,9d downcalls and %,d upcalls ";
|
507 | 510 | recordJsonMetric(AnalysisResults.FOREIGN_DOWNCALLS, (numForeignDowncalls >= 0 ? numForeignDowncalls : UNAVAILABLE_METRIC));
|
508 | 511 | recordJsonMetric(AnalysisResults.FOREIGN_UPCALLS, (numForeignUpcalls >= 0 ? numForeignUpcalls : UNAVAILABLE_METRIC));
|
509 |
| - if (numForeignDowncalls >= 0 || numForeignUpcalls >= 0) { |
| 512 | + if (numForeignDowncalls > 0 || numForeignUpcalls > 0) { |
510 | 513 | l().a(stubsFormat, numForeignDowncalls, numForeignUpcalls)
|
511 | 514 | .doclink("registered for foreign access", "#glossary-foreign-downcall-and-upcall-registrations").println();
|
512 | 515 | }
|
| 516 | + RuntimeResourceSupport runtimeResourceSupport = ImageSingletons.lookup(RuntimeResourceSupport.class); |
| 517 | + int resourceCount = Resources.currentLayer().resources().size(); |
| 518 | + long totalResourceSize = 0; |
| 519 | + for (ConditionalRuntimeValue<ResourceStorageEntryBase> value : Resources.currentLayer().resources().getValues()) { |
| 520 | + if (value.getValueUnconditionally().hasData()) { |
| 521 | + for (byte[] bytes : value.getValueUnconditionally().getData()) { |
| 522 | + totalResourceSize += bytes.length; |
| 523 | + } |
| 524 | + } |
| 525 | + } |
| 526 | + if (resourceCount > 0) { |
| 527 | + l().a("%,9d %s found with %s total size", resourceCount, resourceCount == 1 ? "resource" : "resources", ByteFormattingUtil.bytesToHuman(totalResourceSize)).println(); |
| 528 | + } |
| 529 | + ConditionalRuntimeValue<ResourceStorageEntryBase> value; |
513 | 530 | int numLibraries = libraries.size();
|
514 | 531 | if (numLibraries > 0) {
|
515 | 532 | TreeSet<String> sortedLibraries = new TreeSet<>(libraries);
|
@@ -578,7 +595,7 @@ public void printCreationEnd(int imageFileSize, int heapObjectCount, long imageH
|
578 | 595 | String format = "%9s (%5.2f%%) for ";
|
579 | 596 | l().a(format, ByteFormattingUtil.bytesToHuman(codeAreaSize), Utils.toPercentage(codeAreaSize, imageFileSize))
|
580 | 597 | .doclink("code area", "#glossary-code-area").a(":%,10d compilation units", numCompilations).println();
|
581 |
| - int numResources = Resources.currentLayer().count(); |
| 598 | + int numResources = Resources.currentLayer().resources().size(); |
582 | 599 | recordJsonMetric(ImageDetailKey.IMAGE_HEAP_RESOURCE_COUNT, numResources);
|
583 | 600 | l().a(format, ByteFormattingUtil.bytesToHuman(imageHeapSize), Utils.toPercentage(imageHeapSize, imageFileSize))
|
584 | 601 | .doclink("image heap", "#glossary-image-heap").a(":%,9d objects and %,d resources", heapObjectCount, numResources).println();
|
|
0 commit comments