[PATCH] D47572: [llvm-exegesis][NFCI] Counter::Counter(): more useful msg on even open error

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 00:12:44 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333632: [llvm-exegesis][NFCI] Counter::Counter(): more useful msg on event open error (authored by lebedevri, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47572?vs=149238&id=149239#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47572

Files:
  llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp


Index: llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp
+++ llvm/trunk/tools/llvm-exegesis/lib/PerfHelper.cpp
@@ -96,9 +96,12 @@
   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.149239.patch
Type: text/x-patch
Size: 931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/3eeca65c/attachment.bin>


More information about the llvm-commits mailing list