diff options
Diffstat (limited to 'tools/perf/builtin-trace.c')
| -rw-r--r-- | tools/perf/builtin-trace.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index f5aa6375e3e9..99c8d9ad6729 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -16,6 +16,23 @@ | |||
| 16 | #include <sys/mman.h> | 16 | #include <sys/mman.h> |
| 17 | #include <linux/futex.h> | 17 | #include <linux/futex.h> |
| 18 | 18 | ||
| 19 | /* For older distros: */ | ||
| 20 | #ifndef MAP_STACK | ||
| 21 | # define MAP_STACK 0x20000 | ||
| 22 | #endif | ||
| 23 | |||
| 24 | #ifndef MADV_HWPOISON | ||
| 25 | # define MADV_HWPOISON 100 | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #ifndef MADV_MERGEABLE | ||
| 29 | # define MADV_MERGEABLE 12 | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #ifndef MADV_UNMERGEABLE | ||
| 33 | # define MADV_UNMERGEABLE 13 | ||
| 34 | #endif | ||
| 35 | |||
| 19 | static size_t syscall_arg__scnprintf_hex(char *bf, size_t size, | 36 | static size_t syscall_arg__scnprintf_hex(char *bf, size_t size, |
| 20 | unsigned long arg, | 37 | unsigned long arg, |
| 21 | u8 arg_idx __maybe_unused, | 38 | u8 arg_idx __maybe_unused, |
| @@ -970,7 +987,7 @@ again: | |||
| 970 | err = perf_evlist__parse_sample(evlist, event, &sample); | 987 | err = perf_evlist__parse_sample(evlist, event, &sample); |
| 971 | if (err) { | 988 | if (err) { |
| 972 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); | 989 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); |
| 973 | continue; | 990 | goto next_event; |
| 974 | } | 991 | } |
| 975 | 992 | ||
| 976 | if (trace->base_time == 0) | 993 | if (trace->base_time == 0) |
| @@ -984,18 +1001,20 @@ again: | |||
| 984 | evsel = perf_evlist__id2evsel(evlist, sample.id); | 1001 | evsel = perf_evlist__id2evsel(evlist, sample.id); |
| 985 | if (evsel == NULL) { | 1002 | if (evsel == NULL) { |
| 986 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); | 1003 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); |
| 987 | continue; | 1004 | goto next_event; |
| 988 | } | 1005 | } |
| 989 | 1006 | ||
| 990 | if (sample.raw_data == NULL) { | 1007 | if (sample.raw_data == NULL) { |
| 991 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", | 1008 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", |
| 992 | perf_evsel__name(evsel), sample.tid, | 1009 | perf_evsel__name(evsel), sample.tid, |
| 993 | sample.cpu, sample.raw_size); | 1010 | sample.cpu, sample.raw_size); |
| 994 | continue; | 1011 | goto next_event; |
| 995 | } | 1012 | } |
| 996 | 1013 | ||
| 997 | handler = evsel->handler.func; | 1014 | handler = evsel->handler.func; |
| 998 | handler(trace, evsel, &sample); | 1015 | handler(trace, evsel, &sample); |
| 1016 | next_event: | ||
| 1017 | perf_evlist__mmap_consume(evlist, i); | ||
| 999 | 1018 | ||
| 1000 | if (done) | 1019 | if (done) |
| 1001 | goto out_unmap_evlist; | 1020 | goto out_unmap_evlist; |
| @@ -1038,6 +1057,7 @@ static int trace__replay(struct trace *trace) | |||
| 1038 | 1057 | ||
| 1039 | trace->tool.sample = trace__process_sample; | 1058 | trace->tool.sample = trace__process_sample; |
| 1040 | trace->tool.mmap = perf_event__process_mmap; | 1059 | trace->tool.mmap = perf_event__process_mmap; |
| 1060 | trace->tool.mmap2 = perf_event__process_mmap2; | ||
| 1041 | trace->tool.comm = perf_event__process_comm; | 1061 | trace->tool.comm = perf_event__process_comm; |
| 1042 | trace->tool.exit = perf_event__process_exit; | 1062 | trace->tool.exit = perf_event__process_exit; |
| 1043 | trace->tool.fork = perf_event__process_fork; | 1063 | trace->tool.fork = perf_event__process_fork; |
