File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ interface System {
1414 createDirectory ( directoryName : string ) : void ;
1515 getExecutingFilePath ( ) : string ;
1616 getCurrentDirectory ( ) : string ;
17- getMemoryUsage ( ) : number ;
17+ getMemoryUsage ? ( ) : number ;
1818 exit ( exitCode ?: number ) : void ;
1919}
2020
@@ -128,9 +128,6 @@ var sys: System = (function () {
128128 getCurrentDirectory ( ) {
129129 return new ActiveXObject ( "WScript.Shell" ) . CurrentDirectory ;
130130 } ,
131- getMemoryUsage ( ) {
132- return 0 ;
133- } ,
134131 exit ( exitCode ?: number ) : void {
135132 try {
136133 WScript . Quit ( exitCode ) ;
@@ -234,7 +231,9 @@ var sys: System = (function () {
234231 return ( < any > process ) . cwd ( ) ;
235232 } ,
236233 getMemoryUsage ( ) {
237- global . gc ( ) ;
234+ if ( global . gc ) {
235+ global . gc ( ) ;
236+ }
238237 return process . memoryUsage ( ) . heapUsed ;
239238 } ,
240239 exit ( exitCode ?: number ) : void {
Original file line number Diff line number Diff line change @@ -337,12 +337,16 @@ module ts {
337337
338338 reportDiagnostics ( errors ) ;
339339 if ( commandLine . options . diagnostics ) {
340+ var memoryUsed = sys . getMemoryUsage ? sys . getMemoryUsage ( ) : - 1 ;
340341 reportCountStatistic ( "Files" , program . getSourceFiles ( ) . length ) ;
341342 reportCountStatistic ( "Lines" , countLines ( program ) ) ;
342343 reportCountStatistic ( "Nodes" , checker ? checker . getNodeCount ( ) : 0 ) ;
343344 reportCountStatistic ( "Identifiers" , checker ? checker . getIdentifierCount ( ) : 0 ) ;
344345 reportCountStatistic ( "Symbols" , checker ? checker . getSymbolCount ( ) : 0 ) ;
345346 reportCountStatistic ( "Types" , checker ? checker . getTypeCount ( ) : 0 ) ;
347+ if ( memoryUsed >= 0 ) {
348+ reportStatisticalValue ( "Memory used" , Math . round ( memoryUsed / 1000 ) + "K" ) ;
349+ }
346350 reportTimeStatistic ( "Parse time" , bindStart - parseStart ) ;
347351 reportTimeStatistic ( "Bind time" , checkStart - bindStart ) ;
348352 reportTimeStatistic ( "Check time" , emitStart - checkStart ) ;
You can’t perform that action at this time.
0 commit comments