@@ -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))
@@ -529,6 +532,7 @@ let main1
529532
530533 // Process command line, flags and collect filenames
531534 let sourceFiles =
535+ use parseActivity = activitySource.StartActivity( " fcs:main1:determine_sources" )
532536
533537 // The ParseCompilerOptions function calls imperative function to process "real" args
534538 // Rather than start processing, just collect names, then process them.
@@ -562,6 +566,8 @@ let main1
562566
563567 // If there's a problem building TcConfig, abort
564568 let tcConfig =
569+ use createConfigActivity = activitySource.StartActivity( " fcs:main1:create_tc_config" )
570+
565571 try
566572 TcConfig.Create( tcConfigB, validate = false )
567573 with e ->
@@ -586,10 +592,12 @@ let main1
586592 let foundationalTcConfigP = TcConfigProvider.Constant tcConfig
587593
588594 let sysRes , otherRes , knownUnresolved =
595+ use splitResolutionsActivity = activitySource.StartActivity( " fcs:main1:split_resolutions" )
589596 TcAssemblyResolutions.SplitNonFoundationalResolutions( tcConfig)
590597
591598 // Import basic assemblies
592599 let tcGlobals , frameworkTcImports =
600+ use frameworkImportsActivity = activitySource.StartActivity( " fcs:main:import_framework_references" )
593601 TcImports.BuildFrameworkTcImports( foundationalTcConfigP, sysRes, otherRes)
594602 |> NodeCode.RunImmediateWithoutCancellation
595603
@@ -642,6 +650,7 @@ let main1
642650 ReportTime tcConfig " Import non-system references"
643651
644652 let tcImports =
653+ use nonFrameworkImportsActivity = activitySource.StartActivity( " fcs:main1:import_non_framework_references" )
645654 TcImports.BuildNonFrameworkTcImports( tcConfigP, frameworkTcImports, otherRes, knownUnresolved, dependencyProvider)
646655 |> NodeCode.RunImmediateWithoutCancellation
647656
@@ -660,6 +669,7 @@ let main1
660669 use unwindParsePhase = PushThreadBuildPhaseUntilUnwind BuildPhase.TypeCheck
661670
662671 let tcEnv0 , openDecls0 =
672+ use initialTcEnvActivity = activitySource.StartActivity( " fcs:main1:get_initial_tc_env" )
663673 GetInitialTcEnv( assemblyName, rangeStartup, tcConfig, tcImports, tcGlobals)
664674
665675 // Type check the inputs
@@ -719,7 +729,9 @@ let main1OfAst
719729 disposables : DisposablesTracker ,
720730 inputs : ParsedInput list
721731 ) =
722-
732+
733+ use main1AstActivity = activitySource.StartActivity( " fcs:main1_ast" )
734+
723735 let tryGetMetadataSnapshot = ( fun _ -> None)
724736
725737 let directoryBuildingFrom = Directory.GetCurrentDirectory()
@@ -904,6 +916,8 @@ let main2
904916 exiter : Exiter ,
905917 ilSourceDocs ))
906918 =
919+ use main2Activity = activitySource.StartActivity( " fcs:main2" )
920+
907921
908922 if tcConfig.typeCheckOnly then
909923 exiter.Exit 0
@@ -1012,7 +1026,7 @@ let main3
10121026 exiter : Exiter ,
10131027 ilSourceDocs ))
10141028 =
1015-
1029+ use main3Activity = activitySource.StartActivity ( " fcs:main3 " )
10161030 // Encode the signature data
10171031 ReportTime tcConfig " Encode Interface Data"
10181032 let exportRemapping = MakeExportRemapping generatedCcu generatedCcu.Contents
@@ -1108,6 +1122,7 @@ let main4
11081122 exiter : Exiter ,
11091123 ilSourceDocs ))
11101124 =
1125+ use main4Activity = activitySource.StartActivity( " fcs:main4" )
11111126
11121127 match tcImportsCapture with
11131128 | None -> ()
@@ -1212,6 +1227,7 @@ let main5
12121227 exiter : Exiter ,
12131228 ilSourceDocs ))
12141229 =
1230+ use main5Activity = activitySource.StartActivity( " fcs:main5" )
12151231
12161232 use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Output
12171233
@@ -1244,6 +1260,7 @@ let main6
12441260 exiter : Exiter ,
12451261 ilSourceDocs ))
12461262 =
1263+ use main6Activity = activitySource.StartActivity( " fcs:main6" )
12471264
12481265 ReportTime tcConfig " Write .NET Binary"
12491266
@@ -1368,6 +1385,7 @@ let CompileFromCommandLineArguments
13681385 tcImportsCapture ,
13691386 dynamicAssemblyCreator
13701387 ) =
1388+ use mainActivity = activitySource.StartActivity( " fcs:main" )
13711389
13721390 use disposables = new DisposablesTracker()
13731391 let savedOut = Console.Out
0 commit comments