diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evlist.c | 23 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index cfbe2b99b9aa..bb5dfc5d1e75 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include "util.h" | 9 | #include "util.h" |
10 | #include <api/fs/debugfs.h> | 10 | #include <api/fs/debugfs.h> |
11 | #include <api/fs/fs.h> | ||
11 | #include <poll.h> | 12 | #include <poll.h> |
12 | #include "cpumap.h" | 13 | #include "cpumap.h" |
13 | #include "thread_map.h" | 14 | #include "thread_map.h" |
@@ -1483,6 +1484,28 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused, | |||
1483 | return 0; | 1484 | return 0; |
1484 | } | 1485 | } |
1485 | 1486 | ||
1487 | int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size) | ||
1488 | { | ||
1489 | char sbuf[STRERR_BUFSIZE], *emsg = strerror_r(err, sbuf, sizeof(sbuf)); | ||
1490 | int value; | ||
1491 | |||
1492 | switch (err) { | ||
1493 | case EPERM: | ||
1494 | sysctl__read_int("kernel/perf_event_mlock_kb", &value); | ||
1495 | scnprintf(buf, size, "Error:\t%s.\n" | ||
1496 | "Hint:\tCheck /proc/sys/kernel/perf_event_mlock_kb (%d kB) setting.\n" | ||
1497 | "Hint:\tTried using %zd kB.\n" | ||
1498 | "Hint:\tTry using a bigger -m/--mmap-pages value.", | ||
1499 | emsg, value, evlist->mmap_len / 1024); | ||
1500 | break; | ||
1501 | default: | ||
1502 | scnprintf(buf, size, "%s", emsg); | ||
1503 | break; | ||
1504 | } | ||
1505 | |||
1506 | return 0; | ||
1507 | } | ||
1508 | |||
1486 | void perf_evlist__to_front(struct perf_evlist *evlist, | 1509 | void perf_evlist__to_front(struct perf_evlist *evlist, |
1487 | struct perf_evsel *move_evsel) | 1510 | struct perf_evsel *move_evsel) |
1488 | { | 1511 | { |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 649b0c597283..0ba93f67ab94 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -185,6 +185,7 @@ size_t perf_evlist__fprintf(struct perf_evlist *evlist, FILE *fp); | |||
185 | 185 | ||
186 | int perf_evlist__strerror_tp(struct perf_evlist *evlist, int err, char *buf, size_t size); | 186 | int perf_evlist__strerror_tp(struct perf_evlist *evlist, int err, char *buf, size_t size); |
187 | int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, size_t size); | 187 | int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, size_t size); |
188 | int perf_evlist__strerror_mmap(struct perf_evlist *evlist, int err, char *buf, size_t size); | ||
188 | 189 | ||
189 | static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm) | 190 | static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm) |
190 | { | 191 | { |