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

Implement Text-Based Performance Log #14409

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

brianrob
Copy link
Member

@brianrob brianrob commented Nov 3, 2020

Implements a text-based performance log scheme that writes coarse-grained performance logs:

  • No logs are written unless the user opts-in by setting DOTNET_CLI_PERF_LOG=1.
  • Each log is represented on disk as a directory, containing a collection of log files. Each process involved in an invocation of the CLI writes its own log file. Thus, when new processes are spawned by the CLI, there can be more than one log file.
  • Logs are written by default to <DotnetUserProfilePath>\PerformanceLogs. Logs for an individual invocation of the CLI can be redirected via DOTNET_PERFLOG_DIR.
  • By default, the most recent 10 logs are kept. This is changeable via DOTNET_PERF_LOG_COUNT. Set this variable to -1 to keep all logs.
  • Data in the logs are emitted via PerformanceLogEventSource so that the events can be consumed through other profilers, such as those that use ETW.
  • Sets DOTNET_PERFLOG_DIR when spawning msbuild processes so that msbuild can contribute to the performance log.

cc: @marcpopMSFT, @davidfowl, @DamianEdwards, @bwadswor

@brianrob brianrob requested a review from wli3 November 3, 2020 00:37
@wli3
Copy link

wli3 commented Nov 3, 2020

@sfoslund @dsplaisted @joeloff FYI, I reviewed most of the PR in a fork wli3#1 already

@brianrob
Copy link
Member Author

brianrob commented Nov 3, 2020

Confirmed that GlobalMemoryStatusEx works on nanoserver:

C:\dotnet>type c:\users\ContainerUser\.dotnet\PerformanceLogs\f1cb9ab6bd3f4268be1ff25cb9e6a8db\perf-8764-97a83818cc9c492
1bee3ffa80ac3d72a.log
...
[2020-11-03T19:35:13.3215336Z] Event=Microsoft-Dotnet-CLI-Performance/MemoryConfiguration ProcessID=8764 ThreadID=1
memoryLoad="36" availablePhysicalMB="5172" totalPhysicalMB="8191"
...

@wli3
Copy link

wli3 commented Nov 3, 2020

@brianrob good to merge

@brianrob
Copy link
Member Author

brianrob commented Nov 3, 2020

Thanks @wli3!

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.

4 participants