[PATCH] D107097: [llvm-profgen] An option to ignore parsing MMap events
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 30 15:18:18 PDT 2021
wlei updated this revision to Diff 363223.
wlei added a comment.
lint
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107097/new/
https://reviews.llvm.org/D107097
Files:
llvm/test/tools/llvm-profgen/Inputs/recursion-compression-pseudoprobe-nommap.perfscript
llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
llvm/tools/llvm-profgen/PerfReader.cpp
llvm/tools/llvm-profgen/PerfReader.h
Index: llvm/tools/llvm-profgen/PerfReader.h
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.h
+++ llvm/tools/llvm-profgen/PerfReader.h
@@ -653,6 +653,8 @@
// Samples with the repeating time generated by the perf reader
AggregatedCounter AggregatedSamples;
PerfScriptType PerfType = PERF_UNKNOWN;
+
+ Optional<bool> EventSeenFirst;
};
/*
Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -317,7 +317,13 @@
exitWithError(ErrorMsg);
}
- return Ret.first->second;
+ // Initialize the base address to preferred address.
+ ProfiledBinary &B = Ret.first->second;
+ uint64_t PreferredAddr = B.getPreferredBaseAddress();
+ AddrToBinaryMap[PreferredAddr] = &B;
+ B.setBaseAddress(PreferredAddr);
+
+ return B;
}
void PerfReaderBase::updateBinaryAddress(const MMapEvent &Event) {
@@ -641,6 +647,9 @@
// Record samples by aggregation
Sample->genHashCode();
AggregatedSamples[Hashable<PerfSample>(Sample)]++;
+ if (!EventSeenFirst.hasValue()) {
+ EventSeenFirst = false;
+ }
}
} else {
// LBR sample is encoded in single line after stack sample
@@ -649,6 +658,12 @@
}
void PerfReaderBase::parseMMap2Event(TraceStream &TraceIt) {
+ if (EventSeenFirst.hasValue() && !EventSeenFirst.getValue()) {
+ WithColor::warning() << "Interior mmap event but no leading mmap event!\n";
+ } else if (!EventSeenFirst.hasValue()) {
+ EventSeenFirst = true;
+ }
+
// Parse a line like:
// PERF_RECORD_MMAP2 2113428/2113428: [0x7fd4efb57000(0x204000) @ 0
// 08:04 19532229 3585508847]: r-xp /usr/lib64/libdl-2.17.so
Index: llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
===================================================================
--- llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
+++ llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
@@ -3,6 +3,9 @@
; RUN: FileCheck %s --input-file %t -check-prefix=CHECK-UNCOMPRESS
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --show-unwinder-output --profile-summary-cold-count=0 | FileCheck %s --check-prefix=CHECK-UNWINDER
; RUN: FileCheck %s --input-file %t
+; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe-nommap.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --show-unwinder-output --profile-summary-cold-count=0 | FileCheck %s --check-prefix=CHECK-UNWINDER
+; RUN: FileCheck %s --input-file %t
+
; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:4:1
; CHECK-UNCOMPRESS: 1: 1
Index: llvm/test/tools/llvm-profgen/Inputs/recursion-compression-pseudoprobe-nommap.perfscript
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profgen/Inputs/recursion-compression-pseudoprobe-nommap.perfscript
@@ -0,0 +1,21 @@
+ 2017db
+ 2017ba
+ 2017e5
+ 2017ba
+ 2017e5
+ 2017d9
+ 2017ba
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017b0
+ 2017e5
+ 2017d9
+ 201847
+ 7fcb072a67c3
+ 5541f689495641d7
+ 0x2017cd/0x2017db/P/-/-/0 0x2017b5/0x2017c0/P/-/-/0 0x2017a7/0x2017b2/P/-/-/0 0x2017e0/0x2017a0/P/-/-/0 0x2017cd/0x2017db/P/-/-/0 0x2017b5/0x2017c0/P/-/-/0 0x2017a7/0x2017b2/P/-/-/0 0x2017e0/0x2017a0/P/-/-/0 0x2017cd/0x2017db/P/-/-/0 0x2017d4/0x2017c0/P/-/-/0 0x2017b5/0x2017c0/P/-/-/0 0x2017a7/0x2017b2/P/-/-/0 0x2017ab/0x2017a0/P/-/-/0 0x2017ab/0x2017a0/P/-/-/0 0x2017ab/0x2017a0/P/-/-/0 0x2017ab/0x2017a0/P/-/-/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107097.363223.patch
Type: text/x-patch
Size: 4083 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210730/30f97615/attachment.bin>
More information about the llvm-commits
mailing list