File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -1266,12 +1266,31 @@ function statisticValue(s: Statistic) {
12661266 case StatisticType . time :
12671267 return ( s . value / 1000 ) . toFixed ( 2 ) + "s" ;
12681268 case StatisticType . memory :
1269- return Math . round ( s . value / 1000 ) + "K" ;
1269+ return formatMemory ( s . value ) ;
12701270 default :
12711271 Debug . assertNever ( s . type ) ;
12721272 }
12731273}
12741274
1275+ function formatMemory ( bytes : number ) {
1276+ // bytes -> choose KB/MB/GB with a human friendly format
1277+ const KB = 1024 ;
1278+ const MB = KB * 1024 ;
1279+ const GB = MB * 1024 ;
1280+ const numberOfDigitsAfterTheDecimalPoint = 1 ;
1281+
1282+ if ( bytes >= GB ) {
1283+ return ( bytes / GB ) . toFixed ( numberOfDigitsAfterTheDecimalPoint ) + " GB" ;
1284+ }
1285+
1286+ if ( bytes >= MB ) {
1287+ return ( bytes / MB ) . toFixed ( numberOfDigitsAfterTheDecimalPoint ) + " MB" ;
1288+ }
1289+
1290+ const kilobytesUsed = Math . round ( bytes / KB ) ;
1291+ return kilobytesUsed + " KB" ;
1292+ }
1293+
12751294function writeConfigFile (
12761295 sys : System ,
12771296 reportDiagnostic : DiagnosticReporter ,
You can’t perform that action at this time.
0 commit comments