Skip to content

Commit

Permalink
[llvm-exegesis] Sum counter values when several counters are specifie…
Browse files Browse the repository at this point in the history
…d for a ProcRes.

Summary: This allows handling memory ports on SNB.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Differential Revision: https://reviews.llvm.org/D48076

llvm-svn: 334502
  • Loading branch information
legrosbuffle committed Jun 12, 2018
1 parent 38d9ff7 commit 3827537
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions llvm/tools/llvm-exegesis/lib/Uops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,24 @@ UopsBenchmarkRunner::runMeasurements(const ExecutableFunction &Function,
.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;
Expand Down

0 comments on commit 3827537

Please sign in to comment.