Skip to contentSkip to conversation

perf record: print event causing perf_event_open() to fail

PATCH In review Stephane Eranian 1 participant 2 messages Sep 20, 2012 – Sep 27, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf record: print event causing perf_event_open() to fail

Got tired of not getting the event that caused the perf_event_open() syscall to fail. So I fixed the error message. This is very useful when monitoring lots of events in a single run.

---

tools/perf/builtin-record.c +4 -2
index c643ed6..2cb7434 100644
@@ -297,8 +297,10 @@ static int perf_record__open(struct perf_record *rec)
 			}
 
 			printf("\n");
-			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-			      err, strerror(err));
+			error("sys_perf_event_open() syscall returned with %d "
+			      "(%s) for event %s. /bin/dmesg may provide "
+			      "additional information.\n",
+			      err, strerror(err), perf_evsel__name(pos));
 
 #if defined(__i386__) || defined(__x86_64__)
 			if (attr->type == PERF_TYPE_HARDWARE &&
#1 lore raw

[tip:perf/core] perf record: Print event causing perf_event_open() to fail

Commit-ID:  1863fbbb781b1129da0cfdad46ef875370a34117
Gitweb:     http://git.kernel.org/tip/1863fbbb781b1129da0cfdad46ef875370a34117
Author:     Stephane Eranian <[email protected]>
AuthorDate: Thu, 20 Sep 2012 18:19:45 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 20 Sep 2012 14:44:17 -0300

perf record: Print event causing perf_event_open() to fail

Got tired of not getting the event that caused the perf_event_open() syscall to fail. So I fixed the error message. This is very useful when monitoring lots of events in a single run.

---
 tools/perf/builtin-record.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +4 -2
index c643ed6..2cb7434 100644
@@ -297,8 +297,10 @@ try_again:
 			}
 
 			printf("\n");
-			error("sys_perf_event_open() syscall returned with %d (%s).  /bin/dmesg may provide additional information.\n",
-			      err, strerror(err));
+			error("sys_perf_event_open() syscall returned with %d "
+			      "(%s) for event %s. /bin/dmesg may provide "
+			      "additional information.\n",
+			      err, strerror(err), perf_evsel__name(pos));
 
 #if defined(__i386__) || defined(__x86_64__)
 			if (attr->type == PERF_TYPE_HARDWARE &&