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.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 35e86c6df713..68cd61ef6ac5 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -38,6 +38,7 @@
38#include "util/cpumap.h" 38#include "util/cpumap.h"
39#include "util/xyarray.h" 39#include "util/xyarray.h"
40#include "util/sort.h" 40#include "util/sort.h"
41#include "util/intlist.h"
41 42
42#include "util/debug.h" 43#include "util/debug.h"
43 44
@@ -706,8 +707,16 @@ static void perf_event__process_sample(struct perf_tool *tool,
706 int err; 707 int err;
707 708
708 if (!machine && perf_guest) { 709 if (!machine && perf_guest) {
709 pr_err("Can't find guest [%d]'s kernel information\n", 710 static struct intlist *seen;
710 event->ip.pid); 711
712 if (!seen)
713 seen = intlist__new();
714
715 if (!intlist__has_entry(seen, event->ip.pid)) {
716 pr_err("Can't find guest [%d]'s kernel information\n",
717 event->ip.pid);
718 intlist__add(seen, event->ip.pid);
719 }
711 return; 720 return;
712 } 721 }
713 722
@@ -811,7 +820,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
811 int ret; 820 int ret;
812 821
813 while ((event = perf_evlist__mmap_read(top->evlist, idx)) != NULL) { 822 while ((event = perf_evlist__mmap_read(top->evlist, idx)) != NULL) {
814 ret = perf_session__parse_sample(session, event, &sample); 823 ret = perf_evlist__parse_sample(top->evlist, event, &sample, false);
815 if (ret) { 824 if (ret) {
816 pr_err("Can't parse sample, err = %d\n", ret); 825 pr_err("Can't parse sample, err = %d\n", ret);
817 continue; 826 continue;
@@ -943,8 +952,10 @@ try_again:
943 * based cpu-clock-tick sw counter, which 952 * based cpu-clock-tick sw counter, which
944 * is always available even if no PMU support: 953 * is always available even if no PMU support:
945 */ 954 */
946 if (attr->type == PERF_TYPE_HARDWARE && 955 if ((err == ENOENT || err == ENXIO) &&
947 attr->config == PERF_COUNT_HW_CPU_CYCLES) { 956 (attr->type == PERF_TYPE_HARDWARE) &&
957 (attr->config == PERF_COUNT_HW_CPU_CYCLES)) {
958
948 if (verbose) 959 if (verbose)
949 ui__warning("Cycles event not supported,\n" 960 ui__warning("Cycles event not supported,\n"
950 "trying to fall back to cpu-clock-ticks\n"); 961 "trying to fall back to cpu-clock-ticks\n");
@@ -1032,7 +1043,7 @@ static int __cmd_top(struct perf_top *top)
1032 &top->session->host_machine); 1043 &top->session->host_machine);
1033 perf_top__start_counters(top); 1044 perf_top__start_counters(top);
1034 top->session->evlist = top->evlist; 1045 top->session->evlist = top->evlist;
1035 perf_session__update_sample_type(top->session); 1046 perf_session__set_id_hdr_size(top->session);
1036 1047
1037 /* Wait for a minimal set of events before starting the snapshot */ 1048 /* Wait for a minimal set of events before starting the snapshot */
1038 poll(top->evlist->pollfd, top->evlist->nr_fds, 100); 1049 poll(top->evlist->pollfd, top->evlist->nr_fds, 100);