[llvm] ab5d65e - [llvm-profgen] Ignore stack samples before aggregation
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 13 17:04:17 PDT 2021
Author: wlei
Date: 2021-10-13T16:52:29-07:00
New Revision: ab5d65e6858b25fc07672a0bd2d07f666bde6b51
URL: https://github.com/llvm/llvm-project/commit/ab5d65e6858b25fc07672a0bd2d07f666bde6b51
DIFF: https://github.com/llvm/llvm-project/commit/ab5d65e6858b25fc07672a0bd2d07f666bde6b51.diff
LOG: [llvm-profgen] Ignore stack samples before aggregation
With `ignore-stack-samples`, We can ignore the call stack before the samples aggregation which could reduce some redundant computations.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D111577
Added:
Modified:
llvm/tools/llvm-profgen/PerfReader.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp
index 2aa66832a051a..4478cac82c662 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -647,9 +647,13 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
if (!TraceIt.isAtEoF() && TraceIt.getCurrentLine().startswith(" 0x")) {
// Parsing LBR stack and populate into PerfSample.LBRStack
if (extractLBRStack(TraceIt, Sample->LBRStack)) {
- // Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
- // ranges
- Sample->CallStack.front() = Sample->LBRStack[0].Target;
+ if (IgnoreStackSamples) {
+ Sample->CallStack.clear();
+ } else {
+ // Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
+ // ranges
+ Sample->CallStack.front() = Sample->LBRStack[0].Target;
+ }
// Record samples by aggregation
AggregatedSamples[Hashable<PerfSample>(Sample)] += Count;
}
More information about the llvm-commits
mailing list