diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/probe-event.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 85c8207c25cc..65a1c8252270 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -2157,7 +2157,8 @@ static bool kprobe_blacklist__listed(unsigned long address) | |||
2157 | return !!kprobe_blacklist__find_by_address(&kprobe_blacklist, address); | 2157 | return !!kprobe_blacklist__find_by_address(&kprobe_blacklist, address); |
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | static int perf_probe_event__sprintf(struct perf_probe_event *pev, | 2160 | static int perf_probe_event__sprintf(const char *group, const char *event, |
2161 | struct perf_probe_event *pev, | ||
2161 | const char *module, | 2162 | const char *module, |
2162 | struct strbuf *result) | 2163 | struct strbuf *result) |
2163 | { | 2164 | { |
@@ -2170,7 +2171,7 @@ static int perf_probe_event__sprintf(struct perf_probe_event *pev, | |||
2170 | if (!place) | 2171 | if (!place) |
2171 | return -EINVAL; | 2172 | return -EINVAL; |
2172 | 2173 | ||
2173 | ret = e_snprintf(buf, 128, "%s:%s", pev->group, pev->event); | 2174 | ret = e_snprintf(buf, 128, "%s:%s", group, event); |
2174 | if (ret < 0) | 2175 | if (ret < 0) |
2175 | goto out; | 2176 | goto out; |
2176 | 2177 | ||
@@ -2195,13 +2196,14 @@ out: | |||
2195 | } | 2196 | } |
2196 | 2197 | ||
2197 | /* Show an event */ | 2198 | /* Show an event */ |
2198 | static int show_perf_probe_event(struct perf_probe_event *pev, | 2199 | static int show_perf_probe_event(const char *group, const char *event, |
2200 | struct perf_probe_event *pev, | ||
2199 | const char *module, bool use_stdout) | 2201 | const char *module, bool use_stdout) |
2200 | { | 2202 | { |
2201 | struct strbuf buf = STRBUF_INIT; | 2203 | struct strbuf buf = STRBUF_INIT; |
2202 | int ret; | 2204 | int ret; |
2203 | 2205 | ||
2204 | ret = perf_probe_event__sprintf(pev, module, &buf); | 2206 | ret = perf_probe_event__sprintf(group, event, pev, module, &buf); |
2205 | if (ret >= 0) { | 2207 | if (ret >= 0) { |
2206 | if (use_stdout) | 2208 | if (use_stdout) |
2207 | printf("%s\n", buf.buf); | 2209 | printf("%s\n", buf.buf); |
@@ -2253,7 +2255,8 @@ static int __show_perf_probe_events(int fd, bool is_kprobe, | |||
2253 | is_kprobe); | 2255 | is_kprobe); |
2254 | if (ret < 0) | 2256 | if (ret < 0) |
2255 | goto next; | 2257 | goto next; |
2256 | ret = show_perf_probe_event(&pev, tev.point.module, | 2258 | ret = show_perf_probe_event(pev.group, pev.event, |
2259 | &pev, tev.point.module, | ||
2257 | true); | 2260 | true); |
2258 | } | 2261 | } |
2259 | next: | 2262 | next: |
@@ -2438,7 +2441,7 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, | |||
2438 | int i, fd, ret; | 2441 | int i, fd, ret; |
2439 | struct probe_trace_event *tev = NULL; | 2442 | struct probe_trace_event *tev = NULL; |
2440 | char buf[64]; | 2443 | char buf[64]; |
2441 | const char *event, *group; | 2444 | const char *event = NULL, *group = NULL; |
2442 | struct strlist *namelist; | 2445 | struct strlist *namelist; |
2443 | bool safename; | 2446 | bool safename; |
2444 | 2447 | ||
@@ -2500,15 +2503,12 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, | |||
2500 | /* Add added event name to namelist */ | 2503 | /* Add added event name to namelist */ |
2501 | strlist__add(namelist, event); | 2504 | strlist__add(namelist, event); |
2502 | 2505 | ||
2503 | /* Trick here - save current event/group */ | 2506 | /* We use tev's name for showing new events */ |
2504 | event = pev->event; | 2507 | show_perf_probe_event(tev->group, tev->event, pev, |
2505 | group = pev->group; | 2508 | tev->point.module, false); |
2506 | pev->event = tev->event; | 2509 | /* Save the last valid name */ |
2507 | pev->group = tev->group; | 2510 | event = tev->event; |
2508 | show_perf_probe_event(pev, tev->point.module, false); | 2511 | group = tev->group; |
2509 | /* Trick here - restore current event/group */ | ||
2510 | pev->event = (char *)event; | ||
2511 | pev->group = (char *)group; | ||
2512 | 2512 | ||
2513 | /* | 2513 | /* |
2514 | * Probes after the first probe which comes from same | 2514 | * Probes after the first probe which comes from same |
@@ -2522,11 +2522,10 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, | |||
2522 | warn_uprobe_event_compat(tev); | 2522 | warn_uprobe_event_compat(tev); |
2523 | 2523 | ||
2524 | /* Note that it is possible to skip all events because of blacklist */ | 2524 | /* Note that it is possible to skip all events because of blacklist */ |
2525 | if (ret >= 0 && tev->event) { | 2525 | if (ret >= 0 && event) { |
2526 | /* Show how to use the event. */ | 2526 | /* Show how to use the event. */ |
2527 | pr_info("\nYou can now use it in all perf tools, such as:\n\n"); | 2527 | pr_info("\nYou can now use it in all perf tools, such as:\n\n"); |
2528 | pr_info("\tperf record -e %s:%s -aR sleep 1\n\n", tev->group, | 2528 | pr_info("\tperf record -e %s:%s -aR sleep 1\n\n", group, event); |
2529 | tev->event); | ||
2530 | } | 2529 | } |
2531 | 2530 | ||
2532 | strlist__delete(namelist); | 2531 | strlist__delete(namelist); |