Miscellaneous event tweaks#6725
Conversation
It's not well documented, but EventSource requires that the start and stop event IDs for a single thing be separated by exactly one. Since this one didn't, we weren't getting DURATION_MSEC computed for overall evaluation time in our traces. See https://github.com/dotnet/runtime/blob/f83a9d9689433ce522b91e74a9631c83847e3b64/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs#L3270.
This is a more critical measure than Parse, which is XML->memory, because it includes imports, SDK resolution, and MSBuild logic.
It's pretty rare that the XML parse phase of project load is a signifcant part of evaluation time; it's usually a tiny fraction of overall evaluation.
| /// </summary> | ||
| /// <param name="projectFile">Relevant information about where in the run of the progam it is.</param> | ||
| [Event(11, Keywords = Keywords.All)] | ||
| /// <param name="projectFile">Filename of the project being evaluated.</param> |
There was a problem hiding this comment.
I don't think the previous comment was particularly helpful, but I'm not sure this one is either. It just sounds like an English version of "projectFile for Evaluate," which you could get from the parameter's name and the function name. Be nice if we could just drop them, but I'm guessing some style checker would complain.
ladipro
left a comment
There was a problem hiding this comment.
Is this why the event names were surfaced inconsistently by tools like PerfView?
Evaluate/Start
EvaluateStop/Stop
Can this change break tools relying on the old names, for example:
https://github.com/dotnet/performance/blob/83f1fa22571b6fc4cd054b6ef07e647f12eb6efe/src/tools/ScenarioMeasurement/Startup/InnerLoopMsBuildParser.cs#L107-L115
That is exactly the case that caused me to ask about this and ask for help from @josalem who figured out the mismatch.
Yes, I think so. Do you or @DrewScoggins have an objection to fixing it here and following up with a fix there? I think we could possibly have a redundant stop event to preserve name compat but ideally not for the long term. |
Yes, that code will break with this change, because the events should now show up as If you make this change, you may need to update any readers to account for the name change in For some clarity here,
The odd behavior prior to this patch (having an Another way to fix this would be to explicitly define your tasks by adding a nested class named public sealed MySource : EventSource
{
public class Tasks
{
public const EventTask MyTask = (EventTask)1;
}
[Event(1, OpCode=OpCode.Start, Task=Tasks.MyTask, ...)]
public void MyEventStart() => WriteEvent(1);
// ...
[Event(N, OpCode=OpCode.Stop, Task=Tasks.MyTask, ...)]
public void MyEventStop() => WriteEvent(N);
} |
|
I am happy to make the change on our side, as long as I get a clear list of all of the new names of the events, but I am a little concerned about the breaking change in and of itself.
|
| /// <param name="projectFileName">Relevant information about where in the run of the progam it is.</param> | ||
| [Event(34, Keywords = Keywords.All | Keywords.PerformanceLog)] | ||
| /// <param name="projectFileName">Filename of the project being evaluated.</param> | ||
| [Event(34, Keywords = Keywords.All)] |
There was a problem hiding this comment.
What does Keywords.PerformanceLog do here, and why remove it from ParseStartStop?
There was a problem hiding this comment.
Events tagged with PerformanceLog are included in the text perf log emitted when configured (#5861).
As to why remove this, I put this in the commit message
It's pretty rare that the XML parse phase of project load is a significant part of evaluation time; it's usually a tiny fraction of overall evaluation.
|
Tested this with a fresh build of MSBuild and it looks good to me:
This would be just as breaking for consumers who have strings like
I am not aware of direct impact to customers; these ETW events are primarily for the dev team's use when investigating and this feels to me like a straightforward bug fix.
We can include it in our release notes; I don't think this rises to the level of interest of the overall VS or .NET 6 release notes.
I do not, but we conceivably could. Is it important enough to do so? |
SGTM |
|
@brianrob also pointed out offline that the compat bar would be higher if these events were documented. I don't think we've documented them and couldn't find any evidence of them on docs.microsoft.com, for example searching for I think we should go ahead. |
|
Well... It doesn't seem to have been updated for a while, but there is some Microsoft-endorsed documentation on them. I still agree with going ahead but thought I should throw that out there. I don't think that's even the right folder 😁 |

Make EvaluateStop event adjacent to EvaluateStart
It's not well documented, but EventSource requires that the start and stop event IDs for a single thing be separated by exactly one. Since this one didn't, we weren't getting DURATION_MSEC computed for overall evaluation time in our traces.
See https://github.com/dotnet/runtime/blob/f83a9d9689433ce522b91e74a9631c83847e3b64/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs#L3270.
Update Evaluate* event doc comments
Include EvaluateStart/Stop in DOTNET_PERFLOG
Drop Parse from DOTNET_PERFLOG