@@ -114,8 +114,10 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars
114
114
compilerOptionsFromCommandLine := commandLine .CompilerOptions ()
115
115
116
116
if configFileName != "" {
117
+ configStart := sys .Now ()
117
118
extendedConfigCache := map [tspath.Path ]* tsoptions.ExtendedConfigCacheEntry {}
118
119
configParseResult , errors := tsoptions .GetParsedCommandLineOfConfigFile (configFileName , compilerOptionsFromCommandLine , sys , extendedConfigCache )
120
+ configTime := sys .Now ().Sub (configStart )
119
121
if len (errors ) != 0 {
120
122
// these are unrecoverable errors--exit to report them as diagnostics
121
123
for _ , e := range errors {
@@ -137,6 +139,7 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars
137
139
cb ,
138
140
configParseResult ,
139
141
reportDiagnostic ,
142
+ configTime ,
140
143
), nil
141
144
} else {
142
145
if compilerOptionsFromCommandLine .ShowConfig .IsTrue () {
@@ -155,6 +158,7 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars
155
158
cb ,
156
159
commandLine ,
157
160
reportDiagnostic ,
161
+ 0 , /*configTime*/
158
162
), nil
159
163
}
160
164
@@ -172,24 +176,25 @@ func findConfigFile(searchPath string, fileExists func(string) bool, configName
172
176
return result
173
177
}
174
178
175
- func performCompilation (sys System , cb cbType , config * tsoptions.ParsedCommandLine , reportDiagnostic diagnosticReporter ) ExitStatus {
179
+ func performCompilation (sys System , cb cbType , config * tsoptions.ParsedCommandLine , reportDiagnostic diagnosticReporter , configTime time. Duration ) ExitStatus {
176
180
host := compiler .NewCachedFSCompilerHost (config .CompilerOptions (), sys .GetCurrentDirectory (), sys .FS (), sys .DefaultLibraryPath ())
177
181
// todo: cache, statistics, tracing
178
- parseStart := time .Now ()
182
+ parseStart := sys .Now ()
179
183
program := compiler .NewProgram (compiler.ProgramOptions {
180
184
Config : config ,
181
185
Host : host ,
182
186
})
183
- parseTime := time . Since (parseStart )
187
+ parseTime := sys . Now (). Sub (parseStart )
184
188
185
189
result := emitFilesAndReportErrors (sys , program , reportDiagnostic )
186
190
if result .status != ExitStatusSuccess {
187
191
// compile exited early
188
192
return result .status
189
193
}
190
194
195
+ result .configTime = configTime
191
196
result .parseTime = parseTime
192
- result .totalTime = time . Since ( parseStart )
197
+ result .totalTime = sys . SinceStart ( )
193
198
194
199
if config .CompilerOptions ().Diagnostics .IsTrue () || config .CompilerOptions ().ExtendedDiagnostics .IsTrue () {
195
200
var memStats runtime.MemStats
@@ -217,11 +222,12 @@ type compileAndEmitResult struct {
217
222
diagnostics []* ast.Diagnostic
218
223
emitResult * compiler.EmitResult
219
224
status ExitStatus
225
+ configTime time.Duration
220
226
parseTime time.Duration
221
227
bindTime time.Duration
222
228
checkTime time.Duration
223
- emitTime time.Duration
224
229
totalTime time.Duration
230
+ emitTime time.Duration
225
231
}
226
232
227
233
func emitFilesAndReportErrors (sys System , program * compiler.Program , reportDiagnostic diagnosticReporter ) (result compileAndEmitResult ) {
@@ -236,19 +242,19 @@ func emitFilesAndReportErrors(sys System, program *compiler.Program, reportDiagn
236
242
// Options diagnostics include global diagnostics (even though we collect them separately),
237
243
// and global diagnostics create checkers, which then bind all of the files. Do this binding
238
244
// early so we can track the time.
239
- bindStart := time .Now ()
245
+ bindStart := sys .Now ()
240
246
_ = program .GetBindDiagnostics (ctx , nil )
241
- result .bindTime = time . Since (bindStart )
247
+ result .bindTime = sys . Now (). Sub (bindStart )
242
248
243
249
allDiagnostics = append (allDiagnostics , program .GetOptionsDiagnostics (ctx )... )
244
250
245
251
if options .ListFilesOnly .IsFalseOrUnknown () {
246
252
allDiagnostics = append (allDiagnostics , program .GetGlobalDiagnostics (ctx )... )
247
253
248
254
if len (allDiagnostics ) == configFileParsingDiagnosticsLength {
249
- checkStart := time .Now ()
255
+ checkStart := sys .Now ()
250
256
allDiagnostics = append (allDiagnostics , program .GetSemanticDiagnostics (ctx , nil )... )
251
- result .checkTime = time . Since (checkStart )
257
+ result .checkTime = sys . Now (). Sub (checkStart )
252
258
}
253
259
254
260
if options .NoEmit .IsTrue () && options .GetEmitDeclarations () && len (allDiagnostics ) == configFileParsingDiagnosticsLength {
@@ -259,9 +265,9 @@ func emitFilesAndReportErrors(sys System, program *compiler.Program, reportDiagn
259
265
260
266
emitResult := & compiler.EmitResult {EmitSkipped : true , Diagnostics : []* ast.Diagnostic {}}
261
267
if ! options .ListFilesOnly .IsTrue () {
262
- emitStart := time .Now ()
268
+ emitStart := sys .Now ()
263
269
emitResult = program .Emit (compiler.EmitOptions {})
264
- result .emitTime = time . Since (emitStart )
270
+ result .emitTime = sys . Now (). Sub (emitStart )
265
271
}
266
272
allDiagnostics = append (allDiagnostics , emitResult .Diagnostics ... )
267
273
0 commit comments