-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Replay Binary Log Tool #72619
Replay Binary Log Tool #72619
Conversation
This adds a tool for replaying compilation events from binary logs directly to the compiler server. This is an effective tool for profiling the compiler server as it removes MSBuild overhead from the logs leaving just the compiler. Further because it's integrated into our code base it makes it very easy to evaluate the efficacy of performance fixes. One simply needs to run `replay` with and without the changes against the same binary log and evaluate the differences in perfview.
@dotnet/roslyn-compiler PTAL |
<Compile Include="..\..\Compilers\Core\CommandLine\BuildProtocol.cs" /> | ||
<Compile Include="..\..\Compilers\Core\CommandLine\CompilerServerLogger.cs" /> | ||
<Compile Include="..\..\Compilers\Core\CommandLine\NativeMethods.cs" /> | ||
<Compile Include="..\..\Compilers\Core\Portable\CommitHashAttribute.cs" /> | ||
<Compile Include="..\..\Compilers\Core\Portable\InternalUtilities\PlatformInformation.cs" /> | ||
<Compile Include="..\..\Compilers\Core\Portable\InternalUtilities\Debug.cs" /> | ||
<Compile Include="..\..\Compilers\Core\Portable\InternalUtilities\NullableAttributes.cs" /> | ||
<Compile Include="..\..\Compilers\Shared\BuildServerConnection.cs" /> | ||
<Compile Include="..\..\Compilers\Shared\NamedPipeUtil.cs" /> | ||
<Compile Include="..\..\Compilers\Shared\RuntimeHostInfo.cs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It bothers me a bit that all of these files are needed to effectively run the client side of the build server. Considering changing this in a future PR to be a lot simpler. Essentially:
- Create a shared project that has all of this logic in it.
- Reference that shared project in MS.CA. Then vbc, csc and VBCSCompiler can just use the logic as they have IVT to MS.CA.
- Reference that shared project in MS.Build.Tasks.CA.csproj. It does not reference MS.CA (by very explicit design) hence needs its own copy of the source.
- Reference that project in MS.CA as well.
"${workspaceFolder}/scripts/vscode-build.ps1", | ||
"-filePath", | ||
"${file}", | ||
"-msbuildEngine", | ||
"dotnet" | ||
], | ||
"windows": { | ||
"command": "powershell", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for this anymore as part of our repo setup includes installing pwsh
as a local tool.
Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
@RikkiGibson, @jjonescz PTAL |
src/Tools/Replay/Replay.cs
Outdated
var stopwatch = new Stopwatch(); | ||
stopwatch.Start(); | ||
|
||
var compilerCalls = ReadAllCompilerCalls(options.BinlogPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should reading compiler calls be outside the stopwatch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Yeah that call should be fast compared to compilation times but the point is to measure compilation time so should move this out.
Co-authored-by: Jan Jones <[email protected]>
|
||
var options = new Mono.Options.OptionSet() | ||
{ | ||
{ "b|binlogPath=", "The binary log to relpay", v => binlogPath = v }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "b|binlogPath=", "The binary log to relpay", v => binlogPath = v }, | |
{ "b|binlogPath=", "The binary log to replay", v => binlogPath = v }, |
This adds a tool for replaying compilation events from binary logs directly to the compiler server. This is an effective tool for profiling the compiler server as it removes MSBuild overhead from the logs leaving just the compiler.
Further because it's integrated into our code base it makes it very easy to evaluate the efficacy of performance fixes. One simply needs to run
replay
with and without the changes against the same binary log and evaluate the differences in perfview.