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

[Proposal] Support perf annotate with CoreCLR on Linux #13191

Open
damageboy opened this issue Aug 1, 2019 · 2 comments
Open

[Proposal] Support perf annotate with CoreCLR on Linux #13191

damageboy opened this issue Aug 1, 2019 · 2 comments
Labels
area-Diagnostics-coreclr enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@damageboy
Copy link
Contributor

I'd like to use be able to use perf on linux to profile CoreCLR quickly and effectively to dig into JIT'd code with perf annotate (e.g. more than just flamegraphs and top functions)

perf has various collection controls and knobs not directly available through the PerfCollect script, such as collecting specific HW events etc, for example:

export COMPlus_PerfMapEnabled=1
perf stat -e L1-dcache-loads,L1-dcache-load-misses,L1-dcache-stores ./SomeCoreCLRExecutable

I can get a nice report like this:

 Performance counter stats for './SomeCoreCLRExecutable':

       754,522,181      L1-dcache-loads
         1,727,116      L1-dcache-load-misses     #    0.23% of all L1-dcache hits
       439,282,834      L1-dcache-stores

       0.658335100 seconds time elapsed

       0.626475000 seconds user
       0.023790000 seconds sys

But if I try to collect the same sort of information with perf record & display it with perf annotate to see where/how this is happenning inside the JIT'd code, I can't get annotation of the code generated by the JIT, since there is no executable on disk that perf can peep into with objdump, so perf complains, often like this, while trying to annotate JIT'd code:

No output from objdump -M intel --start-address=0x00007f7fd56697e0 --stop-address=0x00007f7fd5669b74 -l -d --no-show-raw  -C "$1" 2>/dev/null|grep -v "$1:"|expand

It appears such support could be added by providing an alternative objdump executable that can mimic objdump as far as perf is concerned with a --objdump argument.

It would be amazing if CoreCLR could come with support of some sort for this, so that we could use the native provided tools to quickly analyze and dive into what's happening to our code.

Cc:
@brianrob
@janvorli
@adamsitnik

@tommcdon
Copy link
Member

@noahfalk @josalem

@sdmaclea
Copy link
Contributor

sdmaclea commented Nov 5, 2019

dotnet/coreclr#26842 #13462 Implemented the annotation of the generated machine code. It has not implemented the source code annotation piece.

Issue dotnet/coreclr#27066 mentions implementing JIT_CODE_DEBUG_INFO. This would be the preferred mechanism for source code annotation.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 31, 2020
@tommcdon tommcdon added the tracking This issue is tracking the completion of other related issues. label May 6, 2020
@tommcdon tommcdon modified the milestones: 5.0, Future May 6, 2020
@tommcdon tommcdon modified the milestones: Future, 6.0.0 Jul 8, 2020
@tommcdon tommcdon added enhancement Product code improvement that does NOT require public API changes/additions and removed tracking This issue is tracking the completion of other related issues. labels Oct 14, 2020
@tommcdon tommcdon modified the milestones: 6.0.0, Future Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Diagnostics-coreclr enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

4 participants