Skip to content

The EventPipeProfiler cross-platform profiler - #1321

Merged
adamsitnik merged 14 commits into
dotnet:masterfrom
WojciechNagorski:task-EventPipeProfiler
Mar 3, 2020
Merged

adamsitnik merged 14 commits into
dotnet:masterfrom
WojciechNagorski:task-EventPipeProfiler

Conversation

@WojciechNagorski

@WojciechNagorski WojciechNagorski commented Nov 27, 2019 •

Copy link
Copy Markdown
Contributor

Changes for #1315

Currently, I use a local build of Microsoft.Diagnostics.NETCore.Client from dotnet/diagnostics#617. This library support only .Net Core 2.1 so I decided that I create a new library BenchmarkDotNet.Diagnostics.NETCore that contains EventPipeProfiler.

(I don't like the name "NETCore" but I wanted to do it like in Microsoft.Diagnostics.NETCore.Client )

You can run this profiler via command line:

dotnet BenchmarkDotNet.Samples.dll --filter *Algo_Md5VsSha256.Md5* -p EventPipe -j Short

image

Example trace file.zip

image

@adamsitnik

Copy link
Copy Markdown
Member

I've tested the proposed EventPipeProfiler and it works fine. Great work @WojciechNagorski !

I've sent dotnet/diagnostics#700 in order to add .NET Standard 2.0 support to Microsoft.Diagnostics.NETCore.Client so we could just add this diagnoser to existing package without adding .NET Core target.

@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik Thanks. I'm going to finish this task this week.

@adamsitnik

Copy link
Copy Markdown
Member

dotnet/diagnostics#700 got merged and it targets .NET Standard 2.0 now, so IMHO we can add this dependency to main BenchmarkDotNet project and just add the new profiler plugin there

@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik Great. Today I will move EventPipeProfiler to the BenchmarkDotNet project.

@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

I've pushed the updated version of EventPipeProfiler. It is still WIP, I need to test all cases.

@adamsitnik adamsitnik left a comment

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.

@WojciechNagorski thanks for another great PR!

Please address my comments before we merge it. Thanks!

Comment thread BenchmarkDotNet.sln Outdated
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190

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.

please revert all the changes to solution file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will revert the version of Visual Studio. But I think that guilds should be changed, dotnet/project-system#3079 (comment)
and
dotnet/project-system#2863
What do you think?

@WojciechNagorski WojciechNagorski changed the title [WIP] EventPipeProfiler The EventPipeProfiler cross-platform profiler Dec 18, 2019
@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik I made the changes you asked for. I have questions for two topics.

@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik ping

adamsitnik
adamsitnik previously approved these changes Mar 3, 2020

@adamsitnik adamsitnik left a comment

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.

Looks great to me, thank you @WojciechNagorski !

Please let me know if you have some time to address my feedback today. If not, I am going to merge it as it is and send a minor improvement PR.

Once again big thanks!

{
CpuSampling,
GcVerbose,
GcCollect

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.

it would be great to add Jit to this list with inlining and tail call info enabled

Path.GetDirectoryName(fileName).CreateIfNotExists();
benchmarkToTraceFile[parameters.BenchmarkCase] = fileName;

collectingTask = new Task(() =>

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.

nit: we have quite a deep nesting here. in a perfect world, we would move this logic to a separate method and avoid closure capture


public string ShortName => "EventPipe";

private void ConvertToSpeedscope(BenchmarkCase benchmarkCase, string traceFilePath)

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.

this class is responsible for profiling using event pipe (EventPipeProfiler) could you please move everything that is related to exporting to speedscope to a dedicated type?

}
}

// Method copied from https://github.com/dotnet/diagnostics/blob/2c23d3265dd8f642a8d6cf4bb8a135a5ff8b00c2/src/Tools/dotnet-trace/TraceFileFormatConverter.cs#L64

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.

thanks for adding the comment!

[EventSource(Name = EngineEventSource.SourceName)]
public class EngineEventSource : EventSource
{
const string SourceName = "BenchmarkDotNet.EngineEventSource";

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.

it looks like there is no need to extract const if it's used only in once place. Could you please revert this change?

@adamsitnik adamsitnik left a comment

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.

It looks like I need to approve it again after pushing GH suggestions...

@adamsitnik
adamsitnik merged commit c648ff9 into dotnet:master Mar 3, 2020
@AndreyAkinshin AndreyAkinshin added this to the v0.12.1 milestone Mar 3, 2020
@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik I will try to fix it now.

@adamsitnik

Copy link
Copy Markdown
Member

I will try to fix it now.

@WojciechNagorski don't worry about this, I am going to send a small PR with the improvements

@WojciechNagorski

Copy link
Copy Markdown
Contributor Author

@adamsitnik Ok, so I won't change anything. There you can find what I've done so far: #1382

@WojciechNagorski
WojciechNagorski deleted the task-EventPipeProfiler branch March 3, 2020 11:31
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