summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-07-07 14:42:54 -0700
committerYabin Cui <yabinc@google.com>2016-07-07 14:46:01 -0700
commit27816c9bb55b4b818caca815131432ce0eec9ed6 (patch)
treecbff0a7b1918793fd7fb96c1bfe217513fbfdcc0
parenta4f2c631cb8535347850bbfb56a98f846e964d76 (diff)
downloadextras-27816c9bb55b4b818caca815131432ce0eec9ed6.tar.gz
simpleperf: give suggestion when mmap fails.
Bug: 29574526 Change-Id: I72cf2d0e1d15a561314d3c043650479b2c6773ff
-rw-r--r--simpleperf/event_fd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/simpleperf/event_fd.cpp b/simpleperf/event_fd.cpp
index 58e04dc6..09910768 100644
--- a/simpleperf/event_fd.cpp
+++ b/simpleperf/event_fd.cpp
@@ -121,7 +121,13 @@ bool EventFd::MmapContent(size_t mmap_pages) {
size_t mmap_len = (mmap_pages + 1) * page_size;
void* mmap_addr = mmap(nullptr, mmap_len, PROT_READ | PROT_WRITE, MAP_SHARED, perf_event_fd_, 0);
if (mmap_addr == MAP_FAILED) {
+ bool is_perm_error = (errno == EPERM);
PLOG(ERROR) << "mmap() failed for " << Name();
+ if (is_perm_error) {
+ LOG(ERROR) << "It seems the kernel doesn't allow allocating enough "
+ << "buffer for dumping samples, consider decreasing the number of "
+ << "monitored threads(-t), or decreasing mmap pages(-m).";
+ }
return false;
}
mmap_addr_ = mmap_addr;