aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 5352b5e352ed..cf0d21f1ae10 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -392,11 +392,11 @@ static void record_ip(u64 ip, int counter)
392 samples--; 392 samples--;
393} 393}
394 394
395static void process_event(u64 ip, int counter) 395static void process_event(u64 ip, int counter, int user)
396{ 396{
397 samples++; 397 samples++;
398 398
399 if (ip < min_ip || ip > max_ip) { 399 if (user) {
400 userspace_samples++; 400 userspace_samples++;
401 return; 401 return;
402 } 402 }
@@ -509,9 +509,10 @@ static void mmap_read_counter(struct mmap_data *md)
509 509
510 old += size; 510 old += size;
511 511
512 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) { 512 if (event->header.type == PERF_EVENT_SAMPLE) {
513 if (event->header.type & PERF_SAMPLE_IP) 513 int user =
514 process_event(event->ip.ip, md->counter); 514 (event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK) == PERF_EVENT_MISC_USER;
515 process_event(event->ip.ip, md->counter, user);
515 } 516 }
516 } 517 }
517 518