diff options
author | Mathieu Poirier <mathieu.poirier@linaro.org> | 2016-09-16 10:44:03 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-09-29 10:16:58 -0400 |
commit | b15d0a4c828eafc82ea68fcf88db6fa93eeb23d7 (patch) | |
tree | 2a2fda820a33ad60dd1f364f46916eadba460284 /tools/perf/util/parse-events.c | |
parent | 2acad19500c28ce0c4dc3f9bf1dcfc82040b6531 (diff) |
perf tools: Make perf_evsel__append_filter() generic
By making function perf_evsel__append_filter() take a format rather than
an operator it is possible to reuse the code for other purposes (ex.
Intel PT and CoreSight) than tracepoints.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1474037045-31730-2-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2eb8b1ed4cc8..b14784c765eb 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -1767,7 +1767,7 @@ static int set_filter(struct perf_evsel *evsel, const void *arg) | |||
1767 | return -1; | 1767 | return -1; |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | if (perf_evsel__append_filter(evsel, "&&", str) < 0) { | 1770 | if (perf_evsel__append_filter(evsel, "(%s) && (%s)", str) < 0) { |
1771 | fprintf(stderr, | 1771 | fprintf(stderr, |
1772 | "not enough memory to hold filter string\n"); | 1772 | "not enough memory to hold filter string\n"); |
1773 | return -1; | 1773 | return -1; |
@@ -1798,7 +1798,7 @@ static int add_exclude_perf_filter(struct perf_evsel *evsel, | |||
1798 | 1798 | ||
1799 | snprintf(new_filter, sizeof(new_filter), "common_pid != %d", getpid()); | 1799 | snprintf(new_filter, sizeof(new_filter), "common_pid != %d", getpid()); |
1800 | 1800 | ||
1801 | if (perf_evsel__append_filter(evsel, "&&", new_filter) < 0) { | 1801 | if (perf_evsel__append_filter(evsel, "(%s) && (%s)", new_filter) < 0) { |
1802 | fprintf(stderr, | 1802 | fprintf(stderr, |
1803 | "not enough memory to hold filter string\n"); | 1803 | "not enough memory to hold filter string\n"); |
1804 | return -1; | 1804 | return -1; |