[PATCH] D47572: [llvm-exegesis][NFCI] Counter::Counter(): more useful msg on even open error
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 30 23:58:12 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: courbet, RKSimon.
Herald added a subscriber: tschuett.
I'm slowly looking into a new X86 scheduler model,
for AMD Bulldozer CPU, model 2 (bdver2, Piledriver).
And naturally, i have hit that assert :)
I happened to know what it meant, and how to fix it,
but that is not too common knowledge.
Repository:
rL LLVM
https://reviews.llvm.org/D47572
Files:
tools/llvm-exegesis/lib/PerfHelper.cpp
Index: tools/llvm-exegesis/lib/PerfHelper.cpp
===================================================================
--- tools/llvm-exegesis/lib/PerfHelper.cpp
+++ tools/llvm-exegesis/lib/PerfHelper.cpp
@@ -96,9 +96,13 @@
const uint32_t Flags = 0;
perf_event_attr AttrCopy = *Event.attribute();
FileDescriptor = perf_event_open(&AttrCopy, Pid, Cpu, GroupFd, Flags);
- assert(FileDescriptor != -1 &&
- "Unable to open event, make sure your kernel allows user space perf "
- "monitoring.");
+ if (FileDescriptor == -1) {
+ llvm::errs()
+ << "Unable to open event, make sure your kernel allows user space perf "
+ "monitoring.\nYou may want to try:\n$ sudo sh -c 'echo -1 "
+ ">/proc/sys/kernel/perf_event_paranoid'\n";
+ }
+ assert(FileDescriptor != -1 && "Unable to open event");
}
Counter::~Counter() { close(FileDescriptor); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47572.149238.patch
Type: text/x-patch
Size: 888 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/d8ec6459/attachment.bin>
More information about the llvm-commits
mailing list