aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile6
-rw-r--r--tools/perf/builtin-report.c22
-rw-r--r--tools/perf/builtin-top.c35
3 files changed, 46 insertions, 17 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9c6d0ae3708e..f572c90f610e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -381,12 +381,6 @@ ifndef CC_LD_DYNPATH
381 endif 381 endif
382endif 382endif
383 383
384ifdef ZLIB_PATH
385 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
386 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
387endif
388EXTLIBS += -lz
389
390ifdef NEEDS_SOCKET 384ifdef NEEDS_SOCKET
391 EXTLIBS += -lsocket 385 EXTLIBS += -lsocket
392endif 386endif
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 135b7837e6bf..3f5d8ea05ff0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -121,6 +121,7 @@ typedef union event_union {
121static LIST_HEAD(dsos); 121static LIST_HEAD(dsos);
122static struct dso *kernel_dso; 122static struct dso *kernel_dso;
123static struct dso *vdso; 123static struct dso *vdso;
124static struct dso *hypervisor_dso;
124 125
125static void dsos__add(struct dso *dso) 126static void dsos__add(struct dso *dso)
126{ 127{
@@ -202,6 +203,11 @@ static int load_kernel(void)
202 203
203 dsos__add(vdso); 204 dsos__add(vdso);
204 205
206 hypervisor_dso = dso__new("[hypervisor]", 0);
207 if (!hypervisor_dso)
208 return -1;
209 dsos__add(hypervisor_dso);
210
205 return err; 211 return err;
206} 212}
207 213
@@ -640,7 +646,8 @@ sort__sym_print(FILE *fp, struct hist_entry *self)
640 646
641 if (self->sym) { 647 if (self->sym) {
642 ret += fprintf(fp, "[%c] %s", 648 ret += fprintf(fp, "[%c] %s",
643 self->dso == kernel_dso ? 'k' : '.', self->sym->name); 649 self->dso == kernel_dso ? 'k' :
650 self->dso == hypervisor_dso ? 'h' : '.', self->sym->name);
644 } else { 651 } else {
645 ret += fprintf(fp, "%#016llx", (u64)self->ip); 652 ret += fprintf(fp, "%#016llx", (u64)self->ip);
646 } 653 }
@@ -963,6 +970,9 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
963 } 970 }
964 971
965 switch (context) { 972 switch (context) {
973 case PERF_CONTEXT_HV:
974 dso = hypervisor_dso;
975 break;
966 case PERF_CONTEXT_KERNEL: 976 case PERF_CONTEXT_KERNEL:
967 dso = kernel_dso; 977 dso = kernel_dso;
968 break; 978 break;
@@ -1213,6 +1223,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1213 struct map *map = NULL; 1223 struct map *map = NULL;
1214 void *more_data = event->ip.__more_data; 1224 void *more_data = event->ip.__more_data;
1215 struct ip_callchain *chain = NULL; 1225 struct ip_callchain *chain = NULL;
1226 int cpumode;
1216 1227
1217 if (sample_type & PERF_SAMPLE_PERIOD) { 1228 if (sample_type & PERF_SAMPLE_PERIOD) {
1218 period = *(u64 *)more_data; 1229 period = *(u64 *)more_data;
@@ -1256,7 +1267,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1256 if (comm_list && !strlist__has_entry(comm_list, thread->comm)) 1267 if (comm_list && !strlist__has_entry(comm_list, thread->comm))
1257 return 0; 1268 return 0;
1258 1269
1259 if (event->header.misc & PERF_EVENT_MISC_KERNEL) { 1270 cpumode = event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK;
1271
1272 if (cpumode == PERF_EVENT_MISC_KERNEL) {
1260 show = SHOW_KERNEL; 1273 show = SHOW_KERNEL;
1261 level = 'k'; 1274 level = 'k';
1262 1275
@@ -1264,7 +1277,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1264 1277
1265 dprintf(" ...... dso: %s\n", dso->name); 1278 dprintf(" ...... dso: %s\n", dso->name);
1266 1279
1267 } else if (event->header.misc & PERF_EVENT_MISC_USER) { 1280 } else if (cpumode == PERF_EVENT_MISC_USER) {
1268 1281
1269 show = SHOW_USER; 1282 show = SHOW_USER;
1270 level = '.'; 1283 level = '.';
@@ -1272,6 +1285,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1272 } else { 1285 } else {
1273 show = SHOW_HV; 1286 show = SHOW_HV;
1274 level = 'H'; 1287 level = 'H';
1288
1289 dso = hypervisor_dso;
1290
1275 dprintf(" ...... dso: [hypervisor]\n"); 1291 dprintf(" ...... dso: [hypervisor]\n");
1276 } 1292 }
1277 1293
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index cf0d21f1ae10..0506cd6e04cc 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -286,11 +286,31 @@ static void *display_thread(void *arg)
286 return NULL; 286 return NULL;
287} 287}
288 288
289/* Tag samples to be skipped. */
290char *skip_symbols[] = {
291 "default_idle",
292 "cpu_idle",
293 "enter_idle",
294 "exit_idle",
295 "mwait_idle",
296 "ppc64_runlatch_off",
297 "pseries_dedicated_idle_sleep",
298 NULL
299};
300
289static int symbol_filter(struct dso *self, struct symbol *sym) 301static int symbol_filter(struct dso *self, struct symbol *sym)
290{ 302{
291 static int filter_match; 303 static int filter_match;
292 struct sym_entry *syme; 304 struct sym_entry *syme;
293 const char *name = sym->name; 305 const char *name = sym->name;
306 int i;
307
308 /*
309 * ppc64 uses function descriptors and appends a '.' to the
310 * start of every instruction address. Remove it.
311 */
312 if (name[0] == '.')
313 name++;
294 314
295 if (!strcmp(name, "_text") || 315 if (!strcmp(name, "_text") ||
296 !strcmp(name, "_etext") || 316 !strcmp(name, "_etext") ||
@@ -302,13 +322,12 @@ static int symbol_filter(struct dso *self, struct symbol *sym)
302 return 1; 322 return 1;
303 323
304 syme = dso__sym_priv(self, sym); 324 syme = dso__sym_priv(self, sym);
305 /* Tag samples to be skipped. */ 325 for (i = 0; skip_symbols[i]; i++) {
306 if (!strcmp("default_idle", name) || 326 if (!strcmp(skip_symbols[i], name)) {
307 !strcmp("cpu_idle", name) || 327 syme->skip = 1;
308 !strcmp("enter_idle", name) || 328 break;
309 !strcmp("exit_idle", name) || 329 }
310 !strcmp("mwait_idle", name)) 330 }
311 syme->skip = 1;
312 331
313 if (filter_match == 1) { 332 if (filter_match == 1) {
314 filter_end = sym->start; 333 filter_end = sym->start;
@@ -675,7 +694,7 @@ static const struct option options[] = {
675 "put the counters into a counter group"), 694 "put the counters into a counter group"),
676 OPT_STRING('s', "sym-filter", &sym_filter, "pattern", 695 OPT_STRING('s', "sym-filter", &sym_filter, "pattern",
677 "only display symbols matchig this pattern"), 696 "only display symbols matchig this pattern"),
678 OPT_BOOLEAN('z', "zero", &group, 697 OPT_BOOLEAN('z', "zero", &zero,
679 "zero history across updates"), 698 "zero history across updates"),
680 OPT_INTEGER('F', "freq", &freq, 699 OPT_INTEGER('F', "freq", &freq,
681 "profile at this frequency"), 700 "profile at this frequency"),