6464import com .oracle .svm .common .option .CommonOptionParser ;
6565import com .oracle .svm .core .BuildArtifacts ;
6666import com .oracle .svm .core .BuildArtifacts .ArtifactType ;
67+ import com .oracle .svm .core .ByteUtil ;
6768import com .oracle .svm .core .SubstrateGCOptions ;
6869import com .oracle .svm .core .SubstrateOptions ;
6970import com .oracle .svm .core .SubstrateUtil ;
@@ -251,7 +252,7 @@ public void printInitializeEnd(List<Feature> features, ImageClassLoader classLoa
251252 String gcName = Heap .getHeap ().getGC ().getName ();
252253 recordJsonMetric (GeneralInfo .GC , gcName );
253254 long maxHeapSize = SubstrateGCOptions .MaxHeapSize .getValue ();
254- String maxHeapValue = maxHeapSize == 0 ? Heap .getHeap ().getGC ().getDefaultMaxHeapSize () : ByteFormattingUtil .bytesToHuman (maxHeapSize );
255+ String maxHeapValue = maxHeapSize == 0 ? Heap .getHeap ().getGC ().getDefaultMaxHeapSize () : ByteUtil .bytesToHuman (maxHeapSize );
255256 l ().a (" " ).doclink ("Garbage collector" , "#glossary-gc" ).a (": " ).a (gcName ).a (" (" ).doclink ("max heap size" , "#glossary-gc-max-heap-size" ).a (": " ).a (maxHeapValue ).a (")" ).println ();
256257
257258 printFeatures (features );
@@ -447,7 +448,7 @@ private void printResourceInfo() {
447448
448449 l ().printLineSeparator ();
449450 l ().yellowBold ().doclink ("Build resources" , "#glossary-build-resources" ).a (":" ).reset ().println ();
450- l ().a (" - %.2fGB of memory (%.1f%% of system memory, reason: %s)" , ByteFormattingUtil . bytesToGiB (maxMemory ), Utils .toPercentage (maxMemory , totalMemorySize ), memoryUsageReason ).println ();
451+ l ().a (" - %.2fGB of memory (%.1f%% of system memory, reason: %s)" , ByteUtil . bytesToGB (maxMemory ), Utils .toPercentage (maxMemory , totalMemorySize ), memoryUsageReason ).println ();
451452 l ().a (" - %s thread(s) (%.1f%% of %s available processor(s), %s)" ,
452453 maxNumberOfThreads , Utils .toPercentage (maxNumberOfThreads , availableProcessors ), availableProcessors , maxNumberOfThreadsSuffix ).println ();
453454 }
@@ -591,15 +592,15 @@ public void printCreationEnd(int imageFileSize, int heapObjectCount, long imageH
591592 stagePrinter .end (imageTimer .getTotalTime () + writeTimer .getTotalTime () + archiveTimer .getTotalTime ());
592593 creationStageEndCompleted = true ;
593594 String format = "%9s (%5.2f%%) for " ;
594- l ().a (format , ByteFormattingUtil .bytesToHuman (codeAreaSize ), Utils .toPercentage (codeAreaSize , imageFileSize ))
595+ l ().a (format , ByteUtil .bytesToHuman (codeAreaSize ), Utils .toPercentage (codeAreaSize , imageFileSize ))
595596 .doclink ("code area" , "#glossary-code-area" ).a (":%,10d compilation units" , numCompilations ).println ();
596597 int numResources = Resources .singleton ().count ();
597598 recordJsonMetric (ImageDetailKey .IMAGE_HEAP_RESOURCE_COUNT , numResources );
598- l ().a (format , ByteFormattingUtil .bytesToHuman (imageHeapSize ), Utils .toPercentage (imageHeapSize , imageFileSize ))
599+ l ().a (format , ByteUtil .bytesToHuman (imageHeapSize ), Utils .toPercentage (imageHeapSize , imageFileSize ))
599600 .doclink ("image heap" , "#glossary-image-heap" ).a (":%,9d objects and %,d resources" , heapObjectCount , numResources ).println ();
600601 if (debugInfoSize > 0 ) {
601602 recordJsonMetric (ImageDetailKey .DEBUG_INFO_SIZE , debugInfoSize ); // Optional metric
602- DirectPrinter l = l ().a (format , ByteFormattingUtil .bytesToHuman (debugInfoSize ), Utils .toPercentage (debugInfoSize , imageFileSize ))
603+ DirectPrinter l = l ().a (format , ByteUtil .bytesToHuman (debugInfoSize ), Utils .toPercentage (debugInfoSize , imageFileSize ))
603604
604605 .doclink ("debug info" , "#glossary-debug-info" );
605606 if (debugInfoTimer != null ) {
@@ -612,9 +613,9 @@ public void printCreationEnd(int imageFileSize, int heapObjectCount, long imageH
612613 recordJsonMetric (ImageDetailKey .TOTAL_SIZE , imageFileSize );
613614 recordJsonMetric (ImageDetailKey .CODE_AREA_SIZE , codeAreaSize );
614615 recordJsonMetric (ImageDetailKey .NUM_COMP_UNITS , numCompilations );
615- l ().a (format , ByteFormattingUtil .bytesToHuman (otherBytes ), Utils .toPercentage (otherBytes , imageFileSize ))
616+ l ().a (format , ByteUtil .bytesToHuman (otherBytes ), Utils .toPercentage (otherBytes , imageFileSize ))
616617 .doclink ("other data" , "#glossary-other-data" ).println ();
617- l ().a ("%9s in total" , ByteFormattingUtil .bytesToHuman (imageFileSize )).println ();
618+ l ().a ("%9s in total" , ByteUtil .bytesToHuman (imageFileSize )).println ();
618619 printBreakdowns ();
619620 ImageSingletons .lookup (ProgressReporterFeature .class ).afterBreakdowns ();
620621 printRecommendations ();
@@ -652,7 +653,7 @@ private void printBreakdowns() {
652653 if (packagesBySize .hasNext ()) {
653654 Entry <String , Long > e = packagesBySize .next ();
654655 String className = Utils .truncateClassOrPackageName (e .getKey ());
655- codeSizePart = String .format ("%9s %s" , ByteFormattingUtil .bytesToHuman (e .getValue ()), className );
656+ codeSizePart = String .format ("%9s %s" , ByteUtil .bytesToHuman (e .getValue ()), className );
656657 printedCodeBytes += e .getValue ();
657658 printedCodeItems ++;
658659 }
@@ -666,7 +667,7 @@ private void printBreakdowns() {
666667 className = Utils .truncateClassOrPackageName (className );
667668 }
668669 long byteSize = e .byteSize ;
669- heapSizePart = String .format ("%9s %s" , ByteFormattingUtil .bytesToHuman (byteSize ), className );
670+ heapSizePart = String .format ("%9s %s" , ByteUtil .bytesToHuman (byteSize ), className );
670671 printedHeapBytes += byteSize ;
671672 printedHeapItems ++;
672673 }
@@ -680,9 +681,9 @@ private void printBreakdowns() {
680681 int numHeapItems = heapBreakdown .getSortedBreakdownEntries ().size ();
681682 long totalCodeBytes = codeBreakdown .values ().stream ().mapToLong (Long ::longValue ).sum ();
682683
683- p .l ().a (String .format ("%9s for %s more packages" , ByteFormattingUtil .bytesToHuman (totalCodeBytes - printedCodeBytes ), numCodeItems - printedCodeItems ))
684+ p .l ().a (String .format ("%9s for %s more packages" , ByteUtil .bytesToHuman (totalCodeBytes - printedCodeBytes ), numCodeItems - printedCodeItems ))
684685 .jumpToMiddle ()
685- .a (String .format ("%9s for %s more object types" , ByteFormattingUtil .bytesToHuman (heapBreakdown .getTotalHeapSize () - printedHeapBytes ), numHeapItems - printedHeapItems ))
686+ .a (String .format ("%9s for %s more object types" , ByteUtil .bytesToHuman (heapBreakdown .getTotalHeapSize () - printedHeapBytes ), numHeapItems - printedHeapItems ))
686687 .flushln ();
687688 }
688689
@@ -838,7 +839,7 @@ private void printResourceStatistics() {
838839 .doclink ("GCs" , "#glossary-garbage-collections" );
839840 long peakRSS = ProgressReporterCHelper .getPeakRSS ();
840841 if (peakRSS >= 0 ) {
841- p .a (" | " ).doclink ("Peak RSS" , "#glossary-peak-rss" ).a (": " ).a ("%.2fGB" , ByteFormattingUtil . bytesToGiB (peakRSS ));
842+ p .a (" | " ).doclink ("Peak RSS" , "#glossary-peak-rss" ).a (": " ).a ("%.2fGB" , ByteUtil . bytesToGB (peakRSS ));
842843 }
843844 recordJsonMetric (ResourceUsageKey .PEAK_RSS , (peakRSS >= 0 ? peakRSS : UNAVAILABLE_METRIC ));
844845 long processCPUTime = getOperatingSystemMXBean ().getProcessCpuTime ();
@@ -863,7 +864,7 @@ private void checkForExcessiveGarbageCollection() {
863864 .a (": %.1fs spent in %d GCs during the last stage, taking up %.2f%% of the time." ,
864865 Utils .millisToSeconds (gcTimeDeltaMillis ), currentGCStats .totalCount - lastGCStats .totalCount , ratio * 100 )
865866 .println ();
866- l ().a (" Please ensure more than %.2fGB of memory is available for Native Image" , ByteFormattingUtil . bytesToGiB (ProgressReporterCHelper .getPeakRSS ())).println ();
867+ l ().a (" Please ensure more than %s of memory is available for Native Image" , ByteUtil . bytesToHuman (ProgressReporterCHelper .getPeakRSS ())).println ();
867868 l ().a (" to reduce GC overhead and improve image build time." ).println ();
868869 }
869870 lastGCStats = currentGCStats ;
@@ -900,7 +901,7 @@ private static double nanosToSeconds(double nanos) {
900901 }
901902
902903 private static double getUsedMemory () {
903- return ByteFormattingUtil . bytesToGiB (Runtime .getRuntime ().totalMemory () - Runtime .getRuntime ().freeMemory ());
904+ return ByteUtil . bytesToGB (Runtime .getRuntime ().totalMemory () - Runtime .getRuntime ().freeMemory ());
904905 }
905906
906907 private static String stringFilledWith (int size , String fill ) {
0 commit comments