[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
This commit is contained in:
parent
4fcc0ac15e
commit
ab5d65e685
|
@ -647,9 +647,13 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
|
||||||
if (!TraceIt.isAtEoF() && TraceIt.getCurrentLine().startswith(" 0x")) {
|
if (!TraceIt.isAtEoF() && TraceIt.getCurrentLine().startswith(" 0x")) {
|
||||||
// Parsing LBR stack and populate into PerfSample.LBRStack
|
// Parsing LBR stack and populate into PerfSample.LBRStack
|
||||||
if (extractLBRStack(TraceIt, Sample->LBRStack)) {
|
if (extractLBRStack(TraceIt, Sample->LBRStack)) {
|
||||||
// Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
|
if (IgnoreStackSamples) {
|
||||||
// ranges
|
Sample->CallStack.clear();
|
||||||
Sample->CallStack.front() = Sample->LBRStack[0].Target;
|
} 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
|
// Record samples by aggregation
|
||||||
AggregatedSamples[Hashable<PerfSample>(Sample)] += Count;
|
AggregatedSamples[Hashable<PerfSample>(Sample)] += Count;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue