Skip to content

Instrumentation module for BuildCheck#9890

Closed
maridematte wants to merge 7 commits intodotnet:exp/build-analyzersfrom
maridematte:9629
Closed

Instrumentation module for BuildCheck#9890
maridematte wants to merge 7 commits intodotnet:exp/build-analyzersfrom
maridematte:9629

Conversation

@maridematte
Copy link
Copy Markdown
Member

@maridematte maridematte commented Mar 18, 2024

Fixes #9629

Context

We need some timers and performance indicators for BuildCheck.

  • Added an opt in --analyzerStats option so it will report the time the BuildCheck infrastructure and individual analyzers performed.
  • Added timer to a few infrastructure points so we can know how they perform.
  • Currently they are just logged and then show on command line.
    image

@maridematte
Copy link
Copy Markdown
Member Author

Right now we only have time for AnalyzerAcquisitionTime which will be at 0 for now as we don't have analyzers to acquire. For folks working on BuildCheck, I'd love suggestions about where to add timers and performance indicators to, so we can have a more complete view on time.

@maridematte maridematte marked this pull request as ready for review March 18, 2024 17:37
Copy link
Copy Markdown
Contributor

@f-alizada f-alizada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR, left some clarification + nit comments :)

Copy link
Copy Markdown
Contributor

@f-alizada f-alizada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving minor comments, Thank you for the updates!

// We do not want to send tracing stats from in-proc node
return;
}
string infraStatPrefix = "infrastructureStat_";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value "infrastructureStat_" used twice, please consider to share the duplicated value via const variables.

new ParameterlessSwitchInfo( new string[] { "filelogger8", "fl8" }, ParameterlessSwitch.FileLogger8, null),
new ParameterlessSwitchInfo( new string[] { "filelogger9", "fl9" }, ParameterlessSwitch.FileLogger9, null),
new ParameterlessSwitchInfo( new string[] { "distributedfilelogger", "dfl" }, ParameterlessSwitch.DistributedFileLogger, null),
new ParameterlessSwitchInfo( new string[] { "analyzeStats", "as" }, ParameterlessSwitch.AnalyzeStats, null),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: There was a decision not to use the short alias: https://github.com/dotnet/msbuild/blob/25b5f75df908bf749b1283d76b37996c6a02bb67/src/MSBuild/CommandLineSwitches.cs
Just wondering if we want to apply the decision here as well? @JanKrivanek what do you think?

Copy link
Copy Markdown
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - I have couple commnets for consideration

// Infrastructure time keepers, examples for now
internal TimeSpan analyzerAcquisitionTime;
internal long analyzerSetDataSourceTime;
internal long newProjectAnalyzersTime;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all of those be TimeSpans?

}
}

loggingContext.LogCommentFromText(MessageImportance.High, $"BuildCheck run times{Environment.NewLine}");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw. as discussed here: #9853 (comment), the stats might rather be part of analysis, without an opt-in.

The opt-in migh be used to just flip the importance of the messages (default should be MessageImportance.Low - so that it's not part of console/file logs under default verbosity; the current opt-in can promote that to MessageImportance.High to make it visible in console even with the default verbosity)

loggingContext.LogCommentFromText(MessageImportance.High, analyzerData);
}

private string BuildStatsTable(string title, Dictionary<string, TimeSpan> rowData)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For easy viewing and working with data I'd recommend some existing textual table format - e.g. csv or md table

@JanKrivanek JanKrivanek deleted the branch dotnet:exp/build-analyzers April 15, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants