Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzers prototyping - Instrumentation module #9629

Closed
JanKrivanek opened this issue Jan 11, 2024 · 2 comments · Fixed by #10016
Closed

Analyzers prototyping - Instrumentation module #9629

JanKrivanek opened this issue Jan 11, 2024 · 2 comments · Fixed by #10016
Assignees
Labels
Area: BuildCheck Epic Groups multiple user stories. Can be grouped under a theme. triaged

Comments

@JanKrivanek
Copy link
Member

JanKrivanek commented Jan 11, 2024

Context

#9627

This module will handle monitoring and summarization of overhead added by analyzers infrastructure and individual analyzers (will be usefull during build performance investigation). API is yet to be determined but sample is added for illustration

Things to be investigated and decided

Possible tracing API

    public struct ScopeId { }

    public static class Tracing
    {
        ScopeId RegisterScope(string name, ScopeId? parent) { }
        IDisposable EnterScope(ScopeId scope) { }
        void ExitScope(ScopeId scope) { }
        TracingSummary GetSummary() { }
    }
@JanKrivanek JanKrivanek mentioned this issue Jan 11, 2024
14 tasks
@rokonec rokonec changed the title Analyzers prototyping - Tracing module Analyzers prototyping - Instrumentation module Jan 12, 2024
@JanKrivanek
Copy link
Member Author

Some isnpiration from the Roslyn implementation:

> dotnet new console
> dotnet build /p:ReportAnalyzer=true /bl
> .\msbuild.binlog

Image

We do not have to necessarily be same level of detail or structuring in binlog in the V1, though.

We can just flush the stats as a single message or a series of messages, and then have a separate workitem for making those better organized in the Binlog Viewer (similarly as the Roslyn stats have a special case presentation logic: https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/4116c37b386613684c270893f2d0a606f82b465d/src/StructuredLogger/Analyzers/CscTaskAnalyzer.cs#L9)

@baronfel
Copy link
Member

Consider the use of System.Diagnostics.Activity here instead of Tracing directly - a lot of the runtime/tooling have embraced Activities as a more convenient and user-accessible way of tracking not only the duration of a unit of work, but also metadata for that unit of work that might be useful (a la structured logging!) and the parent/child relationships of that unit of work to other units of work. This level of instrumentation is pretty common in our (MS) application frameworks and libraries now. We've got some conceptual docs for it here, and I'm happy to talk more about it - we're making pretty big bets on it BCL-wide.

maridematte added a commit that referenced this issue May 2, 2024
Fixes #9629

Context
We need some timers and performance indicators for BuildCheck.

Added --analyzeStats option so it will report the time the BuildCheck infrastructure and individual analyzers performed to the command line, otherwise this information is just passed to the logger.
Added timer to a few infrastructure points so we can know how they perform.
@baronfel baronfel added the Epic Groups multiple user stories. Can be grouped under a theme. label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BuildCheck Epic Groups multiple user stories. Can be grouped under a theme. triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants