[all-commits] [llvm/llvm-project] 964053: [llvm-profgen] Support LBR only perf script
ictwanglei via All-commits
all-commits at lists.llvm.org
Tue Aug 31 13:29:01 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 964053d56f9b4aeca8950c0835c9e52be0f1d007
https://github.com/llvm/llvm-project/commit/964053d56f9b4aeca8950c0835c9e52be0f1d007
Author: wlei <wlei at fb.com>
Date: 2021-08-31 (Tue, 31 Aug 2021)
Changed paths:
A llvm/test/tools/llvm-profgen/Inputs/noprobe.aggperfscript
A llvm/test/tools/llvm-profgen/Inputs/noprobe.mmap.perfscript
A llvm/test/tools/llvm-profgen/Inputs/noprobe.perfbin
A llvm/test/tools/llvm-profgen/Inputs/noprobe.perfscript
M llvm/test/tools/llvm-profgen/cs-interrupt.test
M llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
M llvm/test/tools/llvm-profgen/inline-cs-pseudoprobe.test
M llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
M llvm/test/tools/llvm-profgen/noinline-cs-pseudoprobe.test
A llvm/test/tools/llvm-profgen/noprobe.test
M llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
M llvm/tools/llvm-profgen/PerfReader.cpp
M llvm/tools/llvm-profgen/PerfReader.h
M llvm/tools/llvm-profgen/ProfileGenerator.cpp
M llvm/tools/llvm-profgen/ProfiledBinary.cpp
M llvm/tools/llvm-profgen/ProfiledBinary.h
M llvm/tools/llvm-profgen/llvm-profgen.cpp
Log Message:
-----------
[llvm-profgen] Support LBR only perf script
This change aims at supporting LBR only sample perf script which is used for regular(Non-CS) profile generation. A LBR perf script includes a batch of LBR sample which starts with a frame pointer and a group of 32 LBR entries is followed. The FROM/TO LBR pair and the range between two consecutive entries (the former entry's TO and the latter entry's FROM) will be used to infer function profile info.
An example of LBR perf script(created by `perf script -F ip,brstack -i perf.data`)
```
40062f 0x40062f/0x4005b0/P/-/-/9 0x400645/0x4005ff/P/-/-/1 0x400637/0x400645/P/-/-/1 ...
4005d7 0x4005d7/0x4005e5/P/-/-/8 0x40062f/0x4005b0/P/-/-/6 0x400645/0x4005ff/P/-/-/1 ...
...
```
For implementation:
- Extended a new child class `LBRPerfReader` for the sample parsing, reused all the functionalities in `extractLBRStack` except for an extension to parsing leading instruction pointer.
- `HybridSample` is reused(just leave the call stack empty) and the parsed samples is still aggregated in `AggregatedSamples`. After that, range samples, branch sample, address samples are computed and recorded.
- Reused `ContextSampleCounterMap` to store the raw profile, since it's no need to aggregation by context, here it just registered one sample counter with a fake context key.
- Unified to use `show-raw-profile` instead of `show-unwinder-output` to dump the intermediate raw profile, see the comments of the format of the raw profile. For CS profile, it remains to output the unwinder output.
Profile generation part will come soon.
Differential Revision: https://reviews.llvm.org/D108153
More information about the All-commits
mailing list