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

JitStatsDiagnoser #2243

Merged
merged 3 commits into from Jan 12, 2023
Merged

JitStatsDiagnoser #2243

merged 3 commits into from Jan 12, 2023

Conversation

adamsitnik
Copy link
Member

I'm currently working on improving System.CommandLine (mainly design, but also perf).

One of the things unique about S.CL is that it's typically used just once, during process startup time. So what matters is the number of JIT compilations. I've implemented this simple diagnoser that prints simple JIT stats.

Sample usage:

dotnet run -c Release -f net7.0 --filter *IntroBasic.Sleep --profiler jit
Method Mean Error StdDev Methods JITted Methods Tiered JIT allocated memory
Sleep 15.53 ms 0.034 ms 0.032 ms 1,102 15 221,736 B

@AndyAyersMS @kunalspathak @stephentoub @EgorBo @kouvel I am opened to extending it, but I need your feedback before I invest my time. I know that PerfView offers more:

image

@adamsitnik adamsitnik added this to the v0.13.4 milestone Jan 11, 2023
@adamsitnik
Copy link
Member Author

Also, I am not sure if TieredCompilationBackgroundJitStart is just "methods tiered" or "the number of times tiered JIT kicked in and started working"

@kunalspathak
Copy link
Member

Thanks @adamsitnik . This should definitely help us in reproing and investigating performance issues. We can add more columns as and when we have a need, but this is a good starter.

@adamsitnik adamsitnik merged commit 12bf220 into master Jan 12, 2023
@adamsitnik adamsitnik deleted the jitStatsDiagnoser branch January 12, 2023 10:34
@EgorBo
Copy link
Member

EgorBo commented Jan 12, 2023

@adamsitnik nice! Methods JITted includes both tier0 and tier1, right?

@adamsitnik
Copy link
Member Author

Methods JITted includes both tier0 and tier1, right?

This is the number of MethodJittingStarted CLR events (that is all I know right now).

@EgorBo
Copy link
Member

EgorBo commented Jan 12, 2023

Ah, right.
Also, it'd be nice for the diagnoser to generate a MethodsJitted.md report that will list all the methods jitted 🙂 can probably contribute that myself if you think it makes sense

@adamsitnik
Copy link
Member Author

think it makes sense

I do, please go ahead and send a PR.

BTW I was also wondering whether we should filter the methods by namespace and for example remove all BenchmarkDotNet* methods from the report.

@kouvel
Copy link
Member

kouvel commented Jan 15, 2023

Also, I am not sure if TieredCompilationBackgroundJitStart is just "methods tiered" or "the number of times tiered JIT kicked in and started working"

This event is emitted when a background thread starts jitting to tier up and includes info about how many methods were pending jitting at that time. The corresponding Stop event is emitted when the background thread stops jitting, and includes info about how many methods were jitted between the Start/Stop events and how many methods are still pending jitting.

@adamsitnik
Copy link
Member Author

@kouvel big thanks for the feedback! I've sent a fix, PTAL: #2246

@KeterSCP
Copy link
Contributor

KeterSCP commented Jan 19, 2023

Are there any plans to make this diagnoser available via attribute?

@adamsitnik
Copy link
Member Author

@KeterSCP There are not, but you can send a PR that adds such an attribute. Here you can find existing attributes for similar diagnosers: https://github.com/dotnet/BenchmarkDotNet/tree/master/src/BenchmarkDotNet.Diagnostics.Windows/Configs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants