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

Log RAR "size" in ETW #6410

Merged
merged 6 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Framework/MSBuildEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ public void GenerateResourceOverallStop()
}

[Event(27, Keywords = Keywords.All | Keywords.PerformanceLog)]
public void RarOverallStart()
public void RarOverallStart(int assembliesCount, int assemblyFilesCount, bool findDependencies)
{
WriteEvent(27);
WriteEvent(27, assembliesCount, assemblyFilesCount, findDependencies);
}

[Event(28, Keywords = Keywords.All | Keywords.PerformanceLog)]
public void RarOverallStop()
public void RarOverallStop(int assembliesCount, int assemblyFilesCount, int resolvedFilesCount, int resolvedDependencyFilesCount, int copyLocalFilesCount)
{
WriteEvent(28);
WriteEvent(28, assembliesCount, assemblyFilesCount, resolvedFilesCount, resolvedDependencyFilesCount, copyLocalFilesCount);
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader
)
{
bool success = true;
MSBuildEventSource.Log.RarOverallStart();
MSBuildEventSource.Log.RarOverallStart(_assemblyNames?.Length ?? 0, _assemblyFiles?.Length ?? 0, _findDependencies);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe do this with ?? -1 to indicate null?

Also, things like _assemblyNames and _assemblyFiles shouldn't change over the course of an execution, right? So only log them at Stop? Can probably move _findDependencies there, too, so everything is together.

Copy link
Member

Choose a reason for hiding this comment

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

I'm also wondering if we care about the difference between _assemblyNames and _assemblyFiles. Only one should be defined, right? And if they have the same meaning (resolve this many things), maybe have like _assemblyNames?.Length ?? _assemblyFiles?.Length ?? -1

Copy link
Member

Choose a reason for hiding this comment

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

Did you decide yea or nay on these two?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had not!

Looks pretty good now

image

I'm also wondering if we care about the difference between _assemblyNames and _assemblyFiles. Only one should be defined, right? And if they have the same meaning (resolve this many things), maybe have like _assemblyNames?.Length ?? _assemblyFiles?.Length ?? -1

They're not the same thing and many/most builds pass into both.

{
try
{
Expand Down Expand Up @@ -2579,7 +2579,7 @@ out _copyLocalFiles
}
}
}
MSBuildEventSource.Log.RarOverallStop();
MSBuildEventSource.Log.RarOverallStop(_assemblyNames.Length, _assemblyFiles.Length, _resolvedFiles?.Length ?? 0, _resolvedDependencyFiles?.Length ?? 0, _copyLocalFiles?.Length ?? 0);
Copy link
Member

Choose a reason for hiding this comment

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

(not crazy familiar with RAR)
_assemblyNames is guaranteed not to be null here? There's a null check at the beginning of the method

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it is because it's initialized to an Array.Empty, but the null check is fast and easy so I'm just going to do it here too.

return success && !Log.HasLoggedErrors;
}
catch (ArgumentException e)
Expand All @@ -2596,7 +2596,7 @@ out _copyLocalFiles
}
}

MSBuildEventSource.Log.RarOverallStop();
MSBuildEventSource.Log.RarOverallStop(_assemblyNames.Length, _assemblyFiles.Length, _resolvedFiles?.Length ?? 0, _resolvedDependencyFiles?.Length ?? 0, _copyLocalFiles?.Length ?? 0);

return success && !Log.HasLoggedErrors;
}
Expand Down