diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3b9d24dc0eda..e104ed3c8418 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -43,8 +43,6 @@ static char *field_sep; | |||
43 | static int input; | 43 | static int input; |
44 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 44 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
45 | 45 | ||
46 | static int dump_trace = 0; | ||
47 | #define dprintf(x...) do { if (dump_trace) printf(x); } while (0) | ||
48 | #define cdprintf(x...) do { if (dump_trace) color_fprintf(stdout, color, x); } while (0) | 46 | #define cdprintf(x...) do { if (dump_trace) color_fprintf(stdout, color, x); } while (0) |
49 | 47 | ||
50 | static int full_paths; | 48 | static int full_paths; |
@@ -713,8 +711,8 @@ got_map: | |||
713 | if ((long long)ip < 0) | 711 | if ((long long)ip < 0) |
714 | dso = kernel_dso; | 712 | dso = kernel_dso; |
715 | } | 713 | } |
716 | dprintf(" ...... dso: %s\n", dso ? dso->name : "<not found>"); | 714 | dump_printf(" ...... dso: %s\n", dso ? dso->name : "<not found>"); |
717 | dprintf(" ...... map: %Lx -> %Lx\n", *ipp, ip); | 715 | dump_printf(" ...... map: %Lx -> %Lx\n", *ipp, ip); |
718 | *ipp = ip; | 716 | *ipp = ip; |
719 | 717 | ||
720 | if (dsop) | 718 | if (dsop) |
@@ -1108,7 +1106,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1108 | more_data += sizeof(u64); | 1106 | more_data += sizeof(u64); |
1109 | } | 1107 | } |
1110 | 1108 | ||
1111 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", | 1109 | dump_printf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", |
1112 | (void *)(offset + head), | 1110 | (void *)(offset + head), |
1113 | (void *)(long)(event->header.size), | 1111 | (void *)(long)(event->header.size), |
1114 | event->header.misc, | 1112 | event->header.misc, |
@@ -1121,7 +1119,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1121 | 1119 | ||
1122 | chain = (void *)more_data; | 1120 | chain = (void *)more_data; |
1123 | 1121 | ||
1124 | dprintf("... chain: nr:%Lu\n", chain->nr); | 1122 | dump_printf("... chain: nr:%Lu\n", chain->nr); |
1125 | 1123 | ||
1126 | if (validate_chain(chain, event) < 0) { | 1124 | if (validate_chain(chain, event) < 0) { |
1127 | eprintf("call-chain problem with event, skipping it.\n"); | 1125 | eprintf("call-chain problem with event, skipping it.\n"); |
@@ -1130,11 +1128,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1130 | 1128 | ||
1131 | if (dump_trace) { | 1129 | if (dump_trace) { |
1132 | for (i = 0; i < chain->nr; i++) | 1130 | for (i = 0; i < chain->nr; i++) |
1133 | dprintf("..... %2d: %016Lx\n", i, chain->ips[i]); | 1131 | dump_printf("..... %2d: %016Lx\n", i, chain->ips[i]); |
1134 | } | 1132 | } |
1135 | } | 1133 | } |
1136 | 1134 | ||
1137 | dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid); | 1135 | dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); |
1138 | 1136 | ||
1139 | if (thread == NULL) { | 1137 | if (thread == NULL) { |
1140 | eprintf("problem processing %d event, skipping it.\n", | 1138 | eprintf("problem processing %d event, skipping it.\n", |
@@ -1153,7 +1151,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1153 | 1151 | ||
1154 | dso = kernel_dso; | 1152 | dso = kernel_dso; |
1155 | 1153 | ||
1156 | dprintf(" ...... dso: %s\n", dso->name); | 1154 | dump_printf(" ...... dso: %s\n", dso->name); |
1157 | 1155 | ||
1158 | } else if (cpumode == PERF_EVENT_MISC_USER) { | 1156 | } else if (cpumode == PERF_EVENT_MISC_USER) { |
1159 | 1157 | ||
@@ -1166,7 +1164,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1166 | 1164 | ||
1167 | dso = hypervisor_dso; | 1165 | dso = hypervisor_dso; |
1168 | 1166 | ||
1169 | dprintf(" ...... dso: [hypervisor]\n"); | 1167 | dump_printf(" ...... dso: [hypervisor]\n"); |
1170 | } | 1168 | } |
1171 | 1169 | ||
1172 | if (show & show_mask) { | 1170 | if (show & show_mask) { |
@@ -1197,7 +1195,7 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | |||
1197 | 1195 | ||
1198 | thread = threads__findnew(event->mmap.pid, &threads, &last_match); | 1196 | thread = threads__findnew(event->mmap.pid, &threads, &last_match); |
1199 | 1197 | ||
1200 | dprintf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n", | 1198 | dump_printf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n", |
1201 | (void *)(offset + head), | 1199 | (void *)(offset + head), |
1202 | (void *)(long)(event->header.size), | 1200 | (void *)(long)(event->header.size), |
1203 | event->mmap.pid, | 1201 | event->mmap.pid, |
@@ -1208,7 +1206,7 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | |||
1208 | event->mmap.filename); | 1206 | event->mmap.filename); |
1209 | 1207 | ||
1210 | if (thread == NULL || map == NULL) { | 1208 | if (thread == NULL || map == NULL) { |
1211 | dprintf("problem processing PERF_EVENT_MMAP, skipping event.\n"); | 1209 | dump_printf("problem processing PERF_EVENT_MMAP, skipping event.\n"); |
1212 | return 0; | 1210 | return 0; |
1213 | } | 1211 | } |
1214 | 1212 | ||
@@ -1225,14 +1223,14 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head) | |||
1225 | 1223 | ||
1226 | thread = threads__findnew(event->comm.pid, &threads, &last_match); | 1224 | thread = threads__findnew(event->comm.pid, &threads, &last_match); |
1227 | 1225 | ||
1228 | dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n", | 1226 | dump_printf("%p [%p]: PERF_EVENT_COMM: %s:%d\n", |
1229 | (void *)(offset + head), | 1227 | (void *)(offset + head), |
1230 | (void *)(long)(event->header.size), | 1228 | (void *)(long)(event->header.size), |
1231 | event->comm.comm, event->comm.pid); | 1229 | event->comm.comm, event->comm.pid); |
1232 | 1230 | ||
1233 | if (thread == NULL || | 1231 | if (thread == NULL || |
1234 | thread__set_comm(thread, event->comm.comm)) { | 1232 | thread__set_comm(thread, event->comm.comm)) { |
1235 | dprintf("problem processing PERF_EVENT_COMM, skipping event.\n"); | 1233 | dump_printf("problem processing PERF_EVENT_COMM, skipping event.\n"); |
1236 | return -1; | 1234 | return -1; |
1237 | } | 1235 | } |
1238 | total_comm++; | 1236 | total_comm++; |
@@ -1249,7 +1247,7 @@ process_task_event(event_t *event, unsigned long offset, unsigned long head) | |||
1249 | thread = threads__findnew(event->fork.pid, &threads, &last_match); | 1247 | thread = threads__findnew(event->fork.pid, &threads, &last_match); |
1250 | parent = threads__findnew(event->fork.ppid, &threads, &last_match); | 1248 | parent = threads__findnew(event->fork.ppid, &threads, &last_match); |
1251 | 1249 | ||
1252 | dprintf("%p [%p]: PERF_EVENT_%s: (%d:%d):(%d:%d)\n", | 1250 | dump_printf("%p [%p]: PERF_EVENT_%s: (%d:%d):(%d:%d)\n", |
1253 | (void *)(offset + head), | 1251 | (void *)(offset + head), |
1254 | (void *)(long)(event->header.size), | 1252 | (void *)(long)(event->header.size), |
1255 | event->header.type == PERF_EVENT_FORK ? "FORK" : "EXIT", | 1253 | event->header.type == PERF_EVENT_FORK ? "FORK" : "EXIT", |
@@ -1267,7 +1265,7 @@ process_task_event(event_t *event, unsigned long offset, unsigned long head) | |||
1267 | return 0; | 1265 | return 0; |
1268 | 1266 | ||
1269 | if (!thread || !parent || thread__fork(thread, parent)) { | 1267 | if (!thread || !parent || thread__fork(thread, parent)) { |
1270 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); | 1268 | dump_printf("problem processing PERF_EVENT_FORK, skipping event.\n"); |
1271 | return -1; | 1269 | return -1; |
1272 | } | 1270 | } |
1273 | total_fork++; | 1271 | total_fork++; |
@@ -1278,7 +1276,7 @@ process_task_event(event_t *event, unsigned long offset, unsigned long head) | |||
1278 | static int | 1276 | static int |
1279 | process_lost_event(event_t *event, unsigned long offset, unsigned long head) | 1277 | process_lost_event(event_t *event, unsigned long offset, unsigned long head) |
1280 | { | 1278 | { |
1281 | dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n", | 1279 | dump_printf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n", |
1282 | (void *)(offset + head), | 1280 | (void *)(offset + head), |
1283 | (void *)(long)(event->header.size), | 1281 | (void *)(long)(event->header.size), |
1284 | event->lost.id, | 1282 | event->lost.id, |
@@ -1298,12 +1296,12 @@ static void trace_event(event_t *event) | |||
1298 | if (!dump_trace) | 1296 | if (!dump_trace) |
1299 | return; | 1297 | return; |
1300 | 1298 | ||
1301 | dprintf("."); | 1299 | dump_printf("."); |
1302 | cdprintf("\n. ... raw event: size %d bytes\n", event->header.size); | 1300 | cdprintf("\n. ... raw event: size %d bytes\n", event->header.size); |
1303 | 1301 | ||
1304 | for (i = 0; i < event->header.size; i++) { | 1302 | for (i = 0; i < event->header.size; i++) { |
1305 | if ((i & 15) == 0) { | 1303 | if ((i & 15) == 0) { |
1306 | dprintf("."); | 1304 | dump_printf("."); |
1307 | cdprintf(" %04x: ", i); | 1305 | cdprintf(" %04x: ", i); |
1308 | } | 1306 | } |
1309 | 1307 | ||
@@ -1322,7 +1320,7 @@ static void trace_event(event_t *event) | |||
1322 | cdprintf("\n"); | 1320 | cdprintf("\n"); |
1323 | } | 1321 | } |
1324 | } | 1322 | } |
1325 | dprintf(".\n"); | 1323 | dump_printf(".\n"); |
1326 | } | 1324 | } |
1327 | 1325 | ||
1328 | static struct perf_header *header; | 1326 | static struct perf_header *header; |
@@ -1359,7 +1357,7 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head) | |||
1359 | event->read.value); | 1357 | event->read.value); |
1360 | } | 1358 | } |
1361 | 1359 | ||
1362 | dprintf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n", | 1360 | dump_printf("%p [%p]: PERF_EVENT_READ: %d %d %s %Lu\n", |
1363 | (void *)(offset + head), | 1361 | (void *)(offset + head), |
1364 | (void *)(long)(event->header.size), | 1362 | (void *)(long)(event->header.size), |
1365 | event->read.pid, | 1363 | event->read.pid, |
@@ -1540,14 +1538,14 @@ more: | |||
1540 | 1538 | ||
1541 | size = event->header.size; | 1539 | size = event->header.size; |
1542 | 1540 | ||
1543 | dprintf("\n%p [%p]: event: %d\n", | 1541 | dump_printf("\n%p [%p]: event: %d\n", |
1544 | (void *)(offset + head), | 1542 | (void *)(offset + head), |
1545 | (void *)(long)event->header.size, | 1543 | (void *)(long)event->header.size, |
1546 | event->header.type); | 1544 | event->header.type); |
1547 | 1545 | ||
1548 | if (!size || process_event(event, offset, head) < 0) { | 1546 | if (!size || process_event(event, offset, head) < 0) { |
1549 | 1547 | ||
1550 | dprintf("%p [%p]: skipping unknown header type: %d\n", | 1548 | dump_printf("%p [%p]: skipping unknown header type: %d\n", |
1551 | (void *)(offset + head), | 1549 | (void *)(offset + head), |
1552 | (void *)(long)(event->header.size), | 1550 | (void *)(long)(event->header.size), |
1553 | event->header.type); | 1551 | event->header.type); |
@@ -1577,12 +1575,12 @@ done: | |||
1577 | rc = EXIT_SUCCESS; | 1575 | rc = EXIT_SUCCESS; |
1578 | close(input); | 1576 | close(input); |
1579 | 1577 | ||
1580 | dprintf(" IP events: %10ld\n", total); | 1578 | dump_printf(" IP events: %10ld\n", total); |
1581 | dprintf(" mmap events: %10ld\n", total_mmap); | 1579 | dump_printf(" mmap events: %10ld\n", total_mmap); |
1582 | dprintf(" comm events: %10ld\n", total_comm); | 1580 | dump_printf(" comm events: %10ld\n", total_comm); |
1583 | dprintf(" fork events: %10ld\n", total_fork); | 1581 | dump_printf(" fork events: %10ld\n", total_fork); |
1584 | dprintf(" lost events: %10ld\n", total_lost); | 1582 | dump_printf(" lost events: %10ld\n", total_lost); |
1585 | dprintf(" unknown events: %10ld\n", total_unknown); | 1583 | dump_printf(" unknown events: %10ld\n", total_unknown); |
1586 | 1584 | ||
1587 | if (dump_trace) | 1585 | if (dump_trace) |
1588 | return 0; | 1586 | return 0; |