File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ interface System {
14
14
createDirectory ( directoryName : string ) : void ;
15
15
getExecutingFilePath ( ) : string ;
16
16
getCurrentDirectory ( ) : string ;
17
- getMemoryUsage ( ) : number ;
17
+ getMemoryUsage ? ( ) : number ;
18
18
exit ( exitCode ?: number ) : void ;
19
19
}
20
20
@@ -128,9 +128,6 @@ var sys: System = (function () {
128
128
getCurrentDirectory ( ) {
129
129
return new ActiveXObject ( "WScript.Shell" ) . CurrentDirectory ;
130
130
} ,
131
- getMemoryUsage ( ) {
132
- return 0 ;
133
- } ,
134
131
exit ( exitCode ?: number ) : void {
135
132
try {
136
133
WScript . Quit ( exitCode ) ;
@@ -234,7 +231,9 @@ var sys: System = (function () {
234
231
return ( < any > process ) . cwd ( ) ;
235
232
} ,
236
233
getMemoryUsage ( ) {
237
- global . gc ( ) ;
234
+ if ( global . gc ) {
235
+ global . gc ( ) ;
236
+ }
238
237
return process . memoryUsage ( ) . heapUsed ;
239
238
} ,
240
239
exit ( exitCode ?: number ) : void {
Original file line number Diff line number Diff line change @@ -337,12 +337,16 @@ module ts {
337
337
338
338
reportDiagnostics ( errors ) ;
339
339
if ( commandLine . options . diagnostics ) {
340
+ var memoryUsed = sys . getMemoryUsage ? sys . getMemoryUsage ( ) : - 1 ;
340
341
reportCountStatistic ( "Files" , program . getSourceFiles ( ) . length ) ;
341
342
reportCountStatistic ( "Lines" , countLines ( program ) ) ;
342
343
reportCountStatistic ( "Nodes" , checker ? checker . getNodeCount ( ) : 0 ) ;
343
344
reportCountStatistic ( "Identifiers" , checker ? checker . getIdentifierCount ( ) : 0 ) ;
344
345
reportCountStatistic ( "Symbols" , checker ? checker . getSymbolCount ( ) : 0 ) ;
345
346
reportCountStatistic ( "Types" , checker ? checker . getTypeCount ( ) : 0 ) ;
347
+ if ( memoryUsed >= 0 ) {
348
+ reportStatisticalValue ( "Memory used" , Math . round ( memoryUsed / 1000 ) + "K" ) ;
349
+ }
346
350
reportTimeStatistic ( "Parse time" , bindStart - parseStart ) ;
347
351
reportTimeStatistic ( "Bind time" , checkStart - bindStart ) ;
348
352
reportTimeStatistic ( "Check time" , emitStart - checkStart ) ;
You can’t perform that action at this time.
0 commit comments