diff options
| -rw-r--r-- | tools/perf/Documentation/perf-probe.txt | 4 | ||||
| -rw-r--r-- | tools/perf/builtin-probe.c | 1 | ||||
| -rw-r--r-- | tools/perf/util/probe-event.c | 9 | ||||
| -rw-r--r-- | tools/perf/util/probe-event.h | 1 |
4 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index 3a8a9ba2b041..947db6fe512c 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt | |||
| @@ -109,6 +109,10 @@ OPTIONS | |||
| 109 | Dry run. With this option, --add and --del doesn't execute actual | 109 | Dry run. With this option, --add and --del doesn't execute actual |
| 110 | adding and removal operations. | 110 | adding and removal operations. |
| 111 | 111 | ||
| 112 | --cache:: | ||
| 113 | Cache the probes (with --add option). Any events which successfully added | ||
| 114 | are also stored in the cache file. | ||
| 115 | |||
| 112 | --max-probes=NUM:: | 116 | --max-probes=NUM:: |
| 113 | Set the maximum number of probe points for an event. Default is 128. | 117 | Set the maximum number of probe points for an event. Default is 128. |
| 114 | 118 | ||
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 9af859b28b15..6d7ab4316449 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
| @@ -512,6 +512,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 512 | "Enable symbol demangling"), | 512 | "Enable symbol demangling"), |
| 513 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, | 513 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, |
| 514 | "Enable kernel symbol demangling"), | 514 | "Enable kernel symbol demangling"), |
| 515 | OPT_BOOLEAN(0, "cache", &probe_conf.cache, "Manipulate probe cache"), | ||
| 515 | OPT_END() | 516 | OPT_END() |
| 516 | }; | 517 | }; |
| 517 | int ret; | 518 | int ret; |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index cbc8a8bf0f36..084756c17309 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -2514,6 +2514,7 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, | |||
| 2514 | { | 2514 | { |
| 2515 | int i, fd, ret; | 2515 | int i, fd, ret; |
| 2516 | struct probe_trace_event *tev = NULL; | 2516 | struct probe_trace_event *tev = NULL; |
| 2517 | struct probe_cache *cache = NULL; | ||
| 2517 | struct strlist *namelist; | 2518 | struct strlist *namelist; |
| 2518 | 2519 | ||
| 2519 | fd = probe_file__open(PF_FL_RW | (pev->uprobes ? PF_FL_UPROBE : 0)); | 2520 | fd = probe_file__open(PF_FL_RW | (pev->uprobes ? PF_FL_UPROBE : 0)); |
| @@ -2555,6 +2556,14 @@ static int __add_probe_trace_events(struct perf_probe_event *pev, | |||
| 2555 | } | 2556 | } |
| 2556 | if (ret == -EINVAL && pev->uprobes) | 2557 | if (ret == -EINVAL && pev->uprobes) |
| 2557 | warn_uprobe_event_compat(tev); | 2558 | warn_uprobe_event_compat(tev); |
| 2559 | if (ret == 0 && probe_conf.cache) { | ||
| 2560 | cache = probe_cache__new(pev->target); | ||
| 2561 | if (!cache || | ||
| 2562 | probe_cache__add_entry(cache, pev, tevs, ntevs) < 0 || | ||
| 2563 | probe_cache__commit(cache) < 0) | ||
| 2564 | pr_warning("Failed to add event to probe cache\n"); | ||
| 2565 | probe_cache__delete(cache); | ||
| 2566 | } | ||
| 2558 | 2567 | ||
| 2559 | strlist__delete(namelist); | 2568 | strlist__delete(namelist); |
| 2560 | close_out: | 2569 | close_out: |
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 0b024ba789e3..432b690d3f17 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h | |||
| @@ -12,6 +12,7 @@ struct probe_conf { | |||
| 12 | bool show_location_range; | 12 | bool show_location_range; |
| 13 | bool force_add; | 13 | bool force_add; |
| 14 | bool no_inlines; | 14 | bool no_inlines; |
| 15 | bool cache; | ||
| 15 | int max_probes; | 16 | int max_probes; |
| 16 | }; | 17 | }; |
| 17 | extern struct probe_conf probe_conf; | 18 | extern struct probe_conf probe_conf; |
