On 23/02/23 01:01, Namhyung Kim wrote: > This implements a tiny parser for the filter expressions used for BPF. > Each expression will be converted to struct perf_bpf_filter_expr and > be passed to a BPF map. > > For now, I'd like to start with the very basic comparisons like EQ or > GT. The LHS should be a term for sample data and the RHS is a number. > The expressions are connected by a comma. For example, > > period > 10000 > ip < 0x1000000000000, cpu == 3 > > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx> > --- > tools/perf/util/Build | 16 +++++++ > tools/perf/util/bpf-filter.c | 37 ++++++++++++++++ > tools/perf/util/bpf-filter.h | 36 ++++++++++++++++ > tools/perf/util/bpf-filter.l | 82 ++++++++++++++++++++++++++++++++++++ > tools/perf/util/bpf-filter.y | 54 ++++++++++++++++++++++++ > 5 files changed, 225 insertions(+) > create mode 100644 tools/perf/util/bpf-filter.c > create mode 100644 tools/perf/util/bpf-filter.h > create mode 100644 tools/perf/util/bpf-filter.l > create mode 100644 tools/perf/util/bpf-filter.y > > diff --git a/tools/perf/util/bpf-filter.h b/tools/perf/util/bpf-filter.h > new file mode 100644 > index 000000000000..fd5b1164a322 > --- /dev/null > +++ b/tools/perf/util/bpf-filter.h > @@ -0,0 +1,36 @@ > +// SPDX-License-Identifier: GPL-2.0 /* */ is preferred SPDX comment style for header files