Extend support for linux tools perf for jitted code#6925
Closed
sathvikl wants to merge 1 commit into
Closed
Conversation
Summary: This patch provides better support for two of the perf tools infra
(a) perf record/report/annotate supported limited profiling of
jitted code. Function/ DSO view worked however assembly profile view
of jitted code was not supported.
With this patch and the latest version of perf tools from
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/
jitted code profile can be viewed at the assembly level.
It works by generating /tmp/perf-<pid>.dump for perf to read jitted code.
There's two choices for clock source to be used for profiling
(.1) use arch_timestamp; perf tooling requires the env variable
JITDUMP_USE_ARCH_TIMESTAMP=1 to be set.
run perf record
(.2) use MONOTONIC_CLOCK;
run perf record -k 1/mono
perf inject --jit -i perf.data -o perf.jitted.data
will inject jit records into perf.data. This will generate an ELF
file for every trace recorded in perf-<pid>.dump. "PERF_RECORD_MMAP2"
entry in inserted into perf.data for each one of these ELF files
created in /tmp.
By default they will be in /tmp unless specified via
env variable JITDUMPDIR.
perf report -i perf.jitted.data will generate the results.
The patch defaults to using arch_timestamp unless
env variable is set to JITDUMP_USE_ARCH_TIMESTAMP=0
(b) It extends support for jitted code for
perf event "intel_pt//" ;PT processor trace recording.
perf record -e intel_pt//u -p <pid>
perf inject --jit -i perf.data -o perf.jitted.data
perf script --itrace=i0ns -F.. -i perf.jitted.data
will produce a trace of the workload.
This requires 4.1+ version of kernel and the latest version of perf.
--itrace option of 0ns is supported only in the latest version.
The env var JITDUMP_USE_ARCH_TIMESTAMP=1 must be set and is used by the
linux perf tools infra.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: This patch provides better support for two of the perf tools infra
(a) perf record/report/annotate supported limited profiling of
jitted code. Function/ DSO view worked however assembly profile view
of jitted code was not supported.
With this patch and the latest version of perf tools from
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/
jitted code profile can be viewed at the assembly level.
There's two choices for clock source to be used for profiling
(.1) use arch_timestamp; perf tooling requires the env variable
JITDUMP_USE_ARCH_TIMESTAMP=1 to be set.
run perf record
(.2) use MONOTONIC_CLOCK;
run perf record -k 1/mono
perf report -i perf.jitted.data will generate the results.
The patch defaults to using arch_timestamp unless
env variable is set to JITDUMP_USE_ARCH_TIMESTAMP=0
(b) It extends support for jitted code for
perf event "intel_pt//" ;PT processor trace recording.
perf record -e intel_pt//u -p
perf inject --jit -i perf.data -o perf.jitted.data
perf script --itrace=i0ns -F.. -i perf.jitted.data
will produce a trace of the workload.
This requires 4.1+ version of kernel and the latest version of perf.
--itrace option of 0ns is supported only in the latest version.
The env var JITDUMP_USE_ARCH_TIMESTAMP=1 must be set and is used by the
linux perf tools infra.