@@ -39,6 +39,7 @@ open FSharp.Compiler.CompilerGlobalState
3939open FSharp.Compiler .CreateILModule
4040open FSharp.Compiler .DependencyManager
4141open FSharp.Compiler .Diagnostics
42+ open FSharp.Compiler .Diagnostics .Activity
4243open FSharp.Compiler .DiagnosticsLogger
4344open FSharp.Compiler .IlxGen
4445open FSharp.Compiler .InfoReader
@@ -166,6 +167,8 @@ let TypeCheck
166167 inputs ,
167168 exiter : Exiter
168169 ) =
170+ use typecheckActivity = activitySource.StartActivity( " typecheck_inputs" )
171+
169172 try
170173 if isNil inputs then
171174 error ( Error( FSComp.SR.fscNoImplementationFiles (), rangeStartup))
@@ -474,6 +477,8 @@ let main1
474477 diagnosticsLoggerProvider : DiagnosticsLoggerProvider ,
475478 disposables : DisposablesTracker
476479 ) =
480+
481+ use mainActivity = new Activity( " main" )
477482
478483 // See Bug 735819
479484 let lcidFromCodePage =
@@ -529,6 +534,7 @@ let main1
529534
530535 // Process command line, flags and collect filenames
531536 let sourceFiles =
537+ use parseActivity = activitySource.StartActivity( " determine_source_files" )
532538
533539 // The ParseCompilerOptions function calls imperative function to process "real" args
534540 // Rather than start processing, just collect names, then process them.
@@ -562,6 +568,8 @@ let main1
562568
563569 // If there's a problem building TcConfig, abort
564570 let tcConfig =
571+ use createConfigActivity = activitySource.StartActivity( " create_tc_config" )
572+
565573 try
566574 TcConfig.Create( tcConfigB, validate = false )
567575 with e ->
@@ -586,10 +594,12 @@ let main1
586594 let foundationalTcConfigP = TcConfigProvider.Constant tcConfig
587595
588596 let sysRes , otherRes , knownUnresolved =
597+ use splitResolutionsActivity = activitySource.StartActivity( " split_resolutions" )
589598 TcAssemblyResolutions.SplitNonFoundationalResolutions( tcConfig)
590599
591600 // Import basic assemblies
592601 let tcGlobals , frameworkTcImports =
602+ use frameworkImportsActivity = activitySource.StartActivity( " import_framework_references" )
593603 TcImports.BuildFrameworkTcImports( foundationalTcConfigP, sysRes, otherRes)
594604 |> NodeCode.RunImmediateWithoutCancellation
595605
@@ -642,6 +652,7 @@ let main1
642652 ReportTime tcConfig " Import non-system references"
643653
644654 let tcImports =
655+ use nonFrameworkImportsActivity = activitySource.StartActivity( " import_non_framework_references" )
645656 TcImports.BuildNonFrameworkTcImports( tcConfigP, frameworkTcImports, otherRes, knownUnresolved, dependencyProvider)
646657 |> NodeCode.RunImmediateWithoutCancellation
647658
@@ -660,6 +671,7 @@ let main1
660671 use unwindParsePhase = PushThreadBuildPhaseUntilUnwind BuildPhase.TypeCheck
661672
662673 let tcEnv0 , openDecls0 =
674+ use initialTcEnvActivity = activitySource.StartActivity( " get_initial_tc_env" )
663675 GetInitialTcEnv( assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
664676
665677 // Type check the inputs
@@ -719,7 +731,9 @@ let main1OfAst
719731 disposables : DisposablesTracker ,
720732 inputs : ParsedInput list
721733 ) =
722-
734+
735+ use main1AstActivity = activitySource.StartActivity( " main1_of_ast" )
736+
723737 let tryGetMetadataSnapshot = ( fun _ -> None)
724738
725739 let directoryBuildingFrom = Directory.GetCurrentDirectory()
@@ -904,6 +918,8 @@ let main2
904918 exiter : Exiter ,
905919 ilSourceDocs ))
906920 =
921+ use main2Activity = activitySource.StartActivity( " main2" )
922+
907923
908924 if tcConfig.typeCheckOnly then
909925 exiter.Exit 0
@@ -1012,7 +1028,7 @@ let main3
10121028 exiter : Exiter ,
10131029 ilSourceDocs ))
10141030 =
1015-
1031+ use main3Activity = activitySource.StartActivity ( " main3 " )
10161032 // Encode the signature data
10171033 ReportTime tcConfig " Encode Interface Data"
10181034 let exportRemapping = MakeExportRemapping generatedCcu generatedCcu.Contents
@@ -1108,6 +1124,7 @@ let main4
11081124 exiter : Exiter ,
11091125 ilSourceDocs ))
11101126 =
1127+ use main4Activity = activitySource.StartActivity( " main4" )
11111128
11121129 match tcImportsCapture with
11131130 | None -> ()
@@ -1211,6 +1228,7 @@ let main5
12111228 exiter : Exiter ,
12121229 ilSourceDocs ))
12131230 =
1231+ use main5Activity = activitySource.StartActivity( " main5" )
12141232
12151233 use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Output
12161234
@@ -1243,6 +1261,7 @@ let main6
12431261 exiter : Exiter ,
12441262 ilSourceDocs ))
12451263 =
1264+ use main6Activity = activitySource.StartActivity( " main6" )
12461265
12471266 ReportTime tcConfig " Write .NET Binary"
12481267
@@ -1379,7 +1398,6 @@ let CompileFromCommandLineArguments
13791398 with _ ->
13801399 ()
13811400 }
1382-
13831401 main1 (
13841402 ctok,
13851403 argv,
0 commit comments