[PATCH] D111384: [llvm-profgen] Deduplicate PID when processing perf input
Wenlei He via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 10 13:43:53 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGda4e5fc86158: [llvm-profgen] Deduplicate PID when processing perf input (authored by wenlei).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111384/new/
https://reviews.llvm.org/D111384
Files:
llvm/tools/llvm-profgen/PerfReader.cpp
Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -322,18 +322,26 @@
// Collect the PIDs
TraceStream TraceIt(PerfTraceFile);
std::string PIDs;
+ std::unordered_set<uint32_t> PIDSet;
while (!TraceIt.isAtEoF()) {
MMapEvent MMap;
if (isMMap2Event(TraceIt.getCurrentLine()) &&
extractMMap2EventForBinary(Binary, TraceIt.getCurrentLine(), MMap)) {
- if (!PIDs.empty()) {
- PIDs.append(",");
+ auto It = PIDSet.emplace(MMap.PID);
+ if (It.second) {
+ if (!PIDs.empty()) {
+ PIDs.append(",");
+ }
+ PIDs.append(utostr(MMap.PID));
}
- PIDs.append(utostr(MMap.PID));
}
TraceIt.advance();
}
+ if (PIDs.empty()) {
+ exitWithError("No relevant mmap event is found in perf data.");
+ }
+
// Run perf script again to retrieve events for PIDs collected above
StringRef ScriptSampleArgs[] = {PerfPath, "script", "--show-mmap-events",
"-F", "ip,brstack", "--pid",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111384.378531.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211010/bde3fd79/attachment.bin>
More information about the llvm-commits
mailing list