| .. | .. |
|---|
| 11 | 11 | #include "util/tool.h" |
|---|
| 12 | 12 | #include "util/session.h" |
|---|
| 13 | 13 | #include "util/data.h" |
|---|
| 14 | +#include "util/map_symbol.h" |
|---|
| 14 | 15 | #include "util/mem-events.h" |
|---|
| 15 | 16 | #include "util/debug.h" |
|---|
| 17 | +#include "util/dso.h" |
|---|
| 18 | +#include "util/map.h" |
|---|
| 16 | 19 | #include "util/symbol.h" |
|---|
| 20 | +#include <linux/err.h> |
|---|
| 17 | 21 | |
|---|
| 18 | 22 | #define MEM_OPERATION_LOAD 0x1 |
|---|
| 19 | 23 | #define MEM_OPERATION_STORE 0x2 |
|---|
| .. | .. |
|---|
| 34 | 38 | const char *str, int unset __maybe_unused) |
|---|
| 35 | 39 | { |
|---|
| 36 | 40 | struct perf_mem *mem = *(struct perf_mem **)opt->value; |
|---|
| 37 | | - int j; |
|---|
| 38 | 41 | |
|---|
| 39 | | - if (strcmp(str, "list")) { |
|---|
| 40 | | - if (!perf_mem_events__parse(str)) { |
|---|
| 41 | | - mem->operation = 0; |
|---|
| 42 | | - return 0; |
|---|
| 43 | | - } |
|---|
| 42 | + if (!strcmp(str, "list")) { |
|---|
| 43 | + perf_mem_events__list(); |
|---|
| 44 | + exit(0); |
|---|
| 45 | + } |
|---|
| 46 | + if (perf_mem_events__parse(str)) |
|---|
| 44 | 47 | exit(-1); |
|---|
| 45 | | - } |
|---|
| 46 | 48 | |
|---|
| 47 | | - for (j = 0; j < PERF_MEM_EVENTS__MAX; j++) { |
|---|
| 48 | | - struct perf_mem_event *e = &perf_mem_events[j]; |
|---|
| 49 | | - |
|---|
| 50 | | - fprintf(stderr, "%-13s%-*s%s\n", |
|---|
| 51 | | - e->tag, |
|---|
| 52 | | - verbose > 0 ? 25 : 0, |
|---|
| 53 | | - verbose > 0 ? perf_mem_events__name(j) : "", |
|---|
| 54 | | - e->supported ? ": available" : ""); |
|---|
| 55 | | - } |
|---|
| 56 | | - exit(0); |
|---|
| 49 | + mem->operation = 0; |
|---|
| 50 | + return 0; |
|---|
| 57 | 51 | } |
|---|
| 58 | 52 | |
|---|
| 59 | 53 | static const char * const __usage[] = { |
|---|
| .. | .. |
|---|
| 119 | 113 | |
|---|
| 120 | 114 | rec_argv[i++] = "-e"; |
|---|
| 121 | 115 | rec_argv[i++] = perf_mem_events__name(j); |
|---|
| 122 | | - }; |
|---|
| 116 | + } |
|---|
| 123 | 117 | |
|---|
| 124 | 118 | if (all_user) |
|---|
| 125 | 119 | rec_argv[i++] = "--all-user"; |
|---|
| .. | .. |
|---|
| 229 | 223 | static int process_sample_event(struct perf_tool *tool, |
|---|
| 230 | 224 | union perf_event *event, |
|---|
| 231 | 225 | struct perf_sample *sample, |
|---|
| 232 | | - struct perf_evsel *evsel __maybe_unused, |
|---|
| 226 | + struct evsel *evsel __maybe_unused, |
|---|
| 233 | 227 | struct machine *machine) |
|---|
| 234 | 228 | { |
|---|
| 235 | 229 | return dump_raw_samples(tool, event, sample, machine); |
|---|
| .. | .. |
|---|
| 238 | 232 | static int report_raw_events(struct perf_mem *mem) |
|---|
| 239 | 233 | { |
|---|
| 240 | 234 | struct perf_data data = { |
|---|
| 241 | | - .file = { |
|---|
| 242 | | - .path = input_name, |
|---|
| 243 | | - }, |
|---|
| 244 | | - .mode = PERF_DATA_MODE_READ, |
|---|
| 245 | | - .force = mem->force, |
|---|
| 235 | + .path = input_name, |
|---|
| 236 | + .mode = PERF_DATA_MODE_READ, |
|---|
| 237 | + .force = mem->force, |
|---|
| 246 | 238 | }; |
|---|
| 247 | 239 | int ret; |
|---|
| 248 | 240 | struct perf_session *session = perf_session__new(&data, false, |
|---|
| 249 | 241 | &mem->tool); |
|---|
| 250 | 242 | |
|---|
| 251 | | - if (session == NULL) |
|---|
| 252 | | - return -1; |
|---|
| 243 | + if (IS_ERR(session)) |
|---|
| 244 | + return PTR_ERR(session); |
|---|
| 253 | 245 | |
|---|
| 254 | 246 | if (mem->cpu_list) { |
|---|
| 255 | 247 | ret = perf_session__cpu_bitmap(session, mem->cpu_list, |
|---|