forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add event source tracing (dotnet/linker#3043)
Adds EventSource events for the start and end of Main() and for the start and end of each call to IStep.Process(). The dotnet/performance scenarios can use ETW events to give a more detailed breakdown of where time is spent. This PR creates a few simple events to be able to track the time the linker takes from process start to end more precisely without any noise from MSBuild. If we want to track more fine-grained details, it will be easy to add them in the future. LinkerStart is emitted right at the start of Main(). LinkerStop is emitted right before returning from Main(). LinkerStepStart is emitted right before calling IStep.Process. LinkerStrpStop is emitted right after IStep.Process returns. Commit migrated from dotnet/linker@65c17f7
- Loading branch information
1 parent
79f0444
commit 79e31e7
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Diagnostics.Tracing; | ||
|
||
namespace Mono.Linker | ||
{ | ||
[EventSource (Name = "Microsoft-DotNET-Linker")] | ||
sealed class LinkerEventSource : EventSource | ||
{ | ||
public static LinkerEventSource Log { get; } = new LinkerEventSource (); | ||
|
||
[Event (1)] | ||
public void LinkerStart (string args) => WriteEvent (1, args); | ||
|
||
[Event (2)] | ||
public void LinkerStop () => WriteEvent (2); | ||
|
||
[Event (3, Keywords = Keywords.Step)] | ||
public void LinkerStepStart (string stepName) => WriteEvent (3, stepName); | ||
|
||
[Event (4, Keywords = Keywords.Step)] | ||
public void LinkerStepStop (string stepName) => WriteEvent (4, stepName); | ||
|
||
public static class Keywords | ||
{ | ||
public const EventKeywords Step = (EventKeywords) (1 << 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters