[PATCH] D48076: [llvm-exegesis] Sum counter values when several counters are specified for a ProcRes.
Clement Courbet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 06:23:44 PDT 2018
courbet created this revision.
courbet added a reviewer: gchatelet.
Herald added a subscriber: tschuett.
This allows handling memory ports on SNB.
Repository:
rL LLVM
https://reviews.llvm.org/D48076
Files:
tools/llvm-exegesis/lib/Uops.cpp
Index: tools/llvm-exegesis/lib/Uops.cpp
===================================================================
--- tools/llvm-exegesis/lib/Uops.cpp
+++ tools/llvm-exegesis/lib/Uops.cpp
@@ -227,18 +227,24 @@
.PfmCounters.IssueCounters[ProcResIdx];
if (!PfmCounters)
continue;
- // FIXME: Sum results when there are several counters for a single ProcRes
+ // We sum counts when there are several counters for a single ProcRes
// (e.g. P23 on SandyBridge).
- pfm::PerfEvent UopPerfEvent(PfmCounters);
- if (!UopPerfEvent.valid())
- llvm::report_fatal_error(
- llvm::Twine("invalid perf event ").concat(PfmCounters));
- pfm::Counter Counter(UopPerfEvent);
- Counter.start();
- Function();
- Counter.stop();
+ int64_t CounterValue = 0;
+ llvm::SmallVector<llvm::StringRef, 2> CounterNames;
+ llvm::StringRef(PfmCounters).split(CounterNames, ',');
+ for (const auto& CounterName : CounterNames) {
+ pfm::PerfEvent UopPerfEvent(CounterName);
+ if (!UopPerfEvent.valid())
+ llvm::report_fatal_error(
+ llvm::Twine("invalid perf event ").concat(PfmCounters));
+ pfm::Counter Counter(UopPerfEvent);
+ Counter.start();
+ Function();
+ Counter.stop();
+ CounterValue += Counter.read();
+ }
Result.push_back({llvm::itostr(ProcResIdx),
- static_cast<double>(Counter.read()) / NumRepetitions,
+ static_cast<double>(CounterValue) / NumRepetitions,
SchedModel.getProcResource(ProcResIdx)->Name});
}
return Result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48076.150938.patch
Type: text/x-patch
Size: 1634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180612/4d7c6a6a/attachment.bin>
More information about the llvm-commits
mailing list