diff options
Diffstat (limited to 'tools/perf/builtin-script.c')
| -rw-r--r-- | tools/perf/builtin-script.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 0852db2ea155..a8bd00f2e557 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
| @@ -32,6 +32,7 @@ enum perf_output_field { | |||
| 32 | PERF_OUTPUT_TRACE = 1U << 6, | 32 | PERF_OUTPUT_TRACE = 1U << 6, |
| 33 | PERF_OUTPUT_IP = 1U << 7, | 33 | PERF_OUTPUT_IP = 1U << 7, |
| 34 | PERF_OUTPUT_SYM = 1U << 8, | 34 | PERF_OUTPUT_SYM = 1U << 8, |
| 35 | PERF_OUTPUT_DSO = 1U << 9, | ||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | struct output_option { | 38 | struct output_option { |
| @@ -47,6 +48,7 @@ struct output_option { | |||
| 47 | {.str = "trace", .field = PERF_OUTPUT_TRACE}, | 48 | {.str = "trace", .field = PERF_OUTPUT_TRACE}, |
| 48 | {.str = "ip", .field = PERF_OUTPUT_IP}, | 49 | {.str = "ip", .field = PERF_OUTPUT_IP}, |
| 49 | {.str = "sym", .field = PERF_OUTPUT_SYM}, | 50 | {.str = "sym", .field = PERF_OUTPUT_SYM}, |
| 51 | {.str = "dso", .field = PERF_OUTPUT_DSO}, | ||
| 50 | }; | 52 | }; |
| 51 | 53 | ||
| 52 | /* default set to maintain compatibility with current format */ | 54 | /* default set to maintain compatibility with current format */ |
| @@ -63,7 +65,7 @@ static struct { | |||
| 63 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 65 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
| 64 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 66 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
| 65 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 67 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
| 66 | PERF_OUTPUT_SYM, | 68 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, |
| 67 | 69 | ||
| 68 | .invalid_fields = PERF_OUTPUT_TRACE, | 70 | .invalid_fields = PERF_OUTPUT_TRACE, |
| 69 | }, | 71 | }, |
| @@ -74,7 +76,7 @@ static struct { | |||
| 74 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 76 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
| 75 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 77 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
| 76 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 78 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
| 77 | PERF_OUTPUT_SYM, | 79 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, |
| 78 | 80 | ||
| 79 | .invalid_fields = PERF_OUTPUT_TRACE, | 81 | .invalid_fields = PERF_OUTPUT_TRACE, |
| 80 | }, | 82 | }, |
| @@ -93,7 +95,7 @@ static struct { | |||
| 93 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 95 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
| 94 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 96 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
| 95 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 97 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
| 96 | PERF_OUTPUT_SYM, | 98 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, |
| 97 | 99 | ||
| 98 | .invalid_fields = PERF_OUTPUT_TRACE, | 100 | .invalid_fields = PERF_OUTPUT_TRACE, |
| 99 | }, | 101 | }, |
| @@ -176,6 +178,11 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, | |||
| 176 | "No addresses to convert to symbols.\n"); | 178 | "No addresses to convert to symbols.\n"); |
| 177 | return -EINVAL; | 179 | return -EINVAL; |
| 178 | } | 180 | } |
| 181 | if (PRINT_FIELD(DSO) && !PRINT_FIELD(IP)) { | ||
| 182 | pr_err("Display of DSO requested but IP is not selected.\n" | ||
| 183 | "No addresses to convert to dso.\n"); | ||
| 184 | return -EINVAL; | ||
| 185 | } | ||
| 179 | 186 | ||
| 180 | if ((PRINT_FIELD(PID) || PRINT_FIELD(TID)) && | 187 | if ((PRINT_FIELD(PID) || PRINT_FIELD(TID)) && |
| 181 | perf_event_attr__check_stype(attr, PERF_SAMPLE_TID, "TID", | 188 | perf_event_attr__check_stype(attr, PERF_SAMPLE_TID, "TID", |
| @@ -304,7 +311,7 @@ static void process_event(union perf_event *event __unused, | |||
| 304 | else | 311 | else |
| 305 | printf("\n"); | 312 | printf("\n"); |
| 306 | perf_session__print_ip(event, sample, session, | 313 | perf_session__print_ip(event, sample, session, |
| 307 | PRINT_FIELD(SYM)); | 314 | PRINT_FIELD(SYM), PRINT_FIELD(DSO)); |
| 308 | } | 315 | } |
| 309 | 316 | ||
| 310 | printf("\n"); | 317 | printf("\n"); |
| @@ -996,7 +1003,7 @@ static const struct option options[] = { | |||
| 996 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", | 1003 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", |
| 997 | "Look for files with symbols relative to this directory"), | 1004 | "Look for files with symbols relative to this directory"), |
| 998 | OPT_CALLBACK('f', "fields", NULL, "str", | 1005 | OPT_CALLBACK('f', "fields", NULL, "str", |
| 999 | "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,ip,sym", | 1006 | "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso", |
| 1000 | parse_output_fields), | 1007 | parse_output_fields), |
| 1001 | 1008 | ||
| 1002 | OPT_END() | 1009 | OPT_END() |
