Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1218720
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4/5] perf probe: Split del_perf_probe_events() |
| Date | 2015-09-04 10:00 +0200 |
| Message-ID | <q4U4H-4eq-29@gated-at.bofh.it> (permalink) |
| References | <q4U4G-4eq-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The del_perf_probe_events() does 2 things:
1. find existing events which match to filter
2. delete such trace events from kernel
But sometimes we need to do something with the trace events. So split
the funtion into two, so that it can access intermediate trace events
name using strlist if needed.
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/probe-file.c | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 36 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index bbb243717ec8..f00b0df56dfe 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -275,7 +275,8 @@ static int __del_trace_probe_event(int fd, struct str_node *ent)
return ret;
}
-int probe_file__del_events(int fd, struct strfilter *filter)
+static int probe_file__get_events(int fd, struct strfilter *filter,
+ struct strlist *plist)
{
struct strlist *namelist;
struct str_node *ent;
@@ -290,12 +291,43 @@ int probe_file__del_events(int fd, struct strfilter *filter)
p = strchr(ent->s, ':');
if ((p && strfilter__compare(filter, p + 1)) ||
strfilter__compare(filter, ent->s)) {
- ret = __del_trace_probe_event(fd, ent);
- if (ret < 0)
- break;
+ strlist__add(plist, ent->s);
+ ret = 0;
}
}
strlist__delete(namelist);
return ret;
}
+
+static int probe_file__del_strlist(int fd, struct strlist *namelist)
+{
+ int ret = 0;
+ struct str_node *ent;
+
+ strlist__for_each(ent, namelist) {
+ ret = __del_trace_probe_event(fd, ent);
+ if (ret < 0)
+ break;
+ }
+ return ret;
+}
+
+int probe_file__del_events(int fd, struct strfilter *filter)
+{
+ struct strlist *namelist;
+ int ret;
+
+ namelist = strlist__new(NULL, NULL);
+ if (!namelist)
+ return -ENOMEM;
+
+ ret = probe_file__get_events(fd, filter, namelist);
+ if (ret < 0)
+ return ret;
+
+ ret = probe_file__del_strlist(fd, namelist);
+ strlist__delete(namelist);
+
+ return ret;
+}
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 10:00 +0200
[PATCH 3/5] perf probe: Move print logic into cmd_probe() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 10:00 +0200
RE: [PATCH 3/5] perf probe: Move print logic into cmd_probe() 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-09-04 13:50 +0200
[PATCH 2/5] perf probe: Attach trace_probe_event with perf_probe_event Namhyung Kim <namhyung@kernel.org> - 2015-09-04 10:00 +0200
RE: [PATCH 2/5] perf probe: Attach trace_probe_event with perf_probe_event 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-09-04 13:40 +0200
Re: [PATCH 2/5] perf probe: Attach trace_probe_event with perf_probe_event Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:00 +0200
[PATCH 4/5] perf probe: Split del_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 10:00 +0200
RE: [PATCH 4/5] perf probe: Split del_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-09-04 14:00 +0200
Re: [PATCH 4/5] perf probe: Split del_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:20 +0200
csiph-web