Skip to content

Minor event pipe profiler improvements - #1381

Merged
adamsitnik merged 13 commits into
masterfrom
minorEventPipeProfilerImprovements
Mar 3, 2020
Merged

adamsitnik merged 13 commits into
masterfrom
minorEventPipeProfilerImprovements

Conversation

@adamsitnik

Copy link
Copy Markdown
Member

No description provided.

@adamsitnik

Copy link
Copy Markdown
Member Author

@WojciechNagorski could you please take a look?

// parameterless constructor required by DiagnosersLoader to support creating this profiler via console line args
public EventPipeProfiler() { }
// we use performExtraBenchmarksRun = false for better first user experience
public EventPipeProfiler() :this(profile: EventPipeProfile.CpuSampling, performExtraBenchmarksRun: false) { }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why this constructor has the performExtraBenchmarksRun parameter with false value as a default. In the second constructor, this parameter has 'true', I think It is not consistent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

because this ctor is used when users specify console line arguments and they simply cant control it from command line level.

We do the same thing for ETWProfiler:

public EtwProfiler() : this(new EtwProfilerConfig(performExtraBenchmarksRun: false)) { }

So, in general, we do it to improve first user experience (shorter time to get the results)

public string ShortName => "EventPipe";

private void ConvertToSpeedscope(BenchmarkCase benchmarkCase, string traceFilePath)
private static ImmutableHashSet<EventPipeProvider> MapToProviders(EventPipeProfile profile, IReadOnlyCollection<EventPipeProvider> providers)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This function has a little different behavior than my old code and the dotnet trace tool.

There you can find the documentation of dotnet trace: https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace

  • --providers <list-of-comma-separated-providers>
    A comma-separated list of EventPipe providers to be enabled. These providers supplement any providers implied by --profile . If there's any inconsistency for a particular provider, this configuration takes precedence over the implicit configuration from the profile.

So for example a user could send:

  1. profile = EventPipeProfile.CpuSampling
  2. providers = new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Verbose, (long) ClrTraceEventParser.Keywords.Default)
 new EventPipeProfiler(EventPipeProfile.CpuSampling, new [] { new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Verbose, (long) ClrTraceEventParser.Keywords.Default | ClrTraceEventParser.Keywords.JitTracing)});

This should give all the providers sent by the user and all providers resulting from the profile except those that were sent in the providers.

In the above example it should use:

  1. sent by user - new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Verbose, (long) ClrTraceEventParser.Keywords.Default | ClrTraceEventParser.Keywords.JitTracing)
  2. from the profile - new EventPipeProvider("Microsoft-DotNETCore-SampleProfiler", EventLevel.Informational)

This from the profile won't be used:
new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Informational, (long) ClrTraceEventParser.Keywords.Default)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@WojciechNagorski great catch! I've added tests for that and fixed it. PTAL again

68a207d

@WojciechNagorski WojciechNagorski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@adamsitnik
adamsitnik merged commit 3defd78 into master Mar 3, 2020
@adamsitnik
adamsitnik deleted the minorEventPipeProfilerImprovements branch March 3, 2020 14:04
@AndreyAkinshin AndreyAkinshin added this to the v0.12.1 milestone Mar 3, 2020
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