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) {
1266
1266
case StatisticType . time :
1267
1267
return ( s . value / 1000 ) . toFixed ( 2 ) + "s" ;
1268
1268
case StatisticType . memory :
1269
- return Math . round ( s . value / 1000 ) + "K" ;
1269
+ return formatMemory ( s . value ) ;
1270
1270
default :
1271
1271
Debug . assertNever ( s . type ) ;
1272
1272
}
1273
1273
}
1274
1274
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
+
1275
1294
function writeConfigFile (
1276
1295
sys : System ,
1277
1296
reportDiagnostic : DiagnosticReporter ,
You can’t perform that action at this time.
0 commit comments