diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2015-04-24 18:47:48 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-04 12:43:55 -0300 |
commit | 96b55e39237b8bc92d8e6b96f896c106f2d39cf6 (patch) | |
tree | aeb9aac9ff869cb360d0507df44d986df2c0e720 /tools/perf/builtin-probe.c | |
parent | 3f51972c599cf95702819bd06a7a5412c523ebfe (diff) | |
download | op-kernel-dev-96b55e39237b8bc92d8e6b96f896c106f2d39cf6.zip op-kernel-dev-96b55e39237b8bc92d8e6b96f896c106f2d39cf6.tar.gz |
perf probe: Accept multiple filter options
Accept multiple filter options. Each filters are combined by logical-or.
E.g. --filter abc* --filter *def is same as --filter abc*|*def
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 92dcce0..be17075 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -262,21 +262,25 @@ static int opt_set_filter(const struct option *opt __maybe_unused, const char *str, int unset __maybe_unused) { const char *err; + int ret = 0; if (str) { pr_debug2("Set filter: %s\n", str); - if (params.filter) - strfilter__delete(params.filter); - params.filter = strfilter__new(str, &err); if (!params.filter) { + params.filter = strfilter__new(str, &err); + if (!params.filter) + ret = err ? -EINVAL : -ENOMEM; + } else + ret = strfilter__or(params.filter, str, &err); + + if (ret == -EINVAL) { pr_err("Filter parse error at %td.\n", err - str + 1); pr_err("Source: \"%s\"\n", str); pr_err(" %*c\n", (int)(err - str + 1), '^'); - return -EINVAL; } } - return 0; + return ret; } static int init_params(void) |