From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Add the following functions to the libtracecmd library: tracecmd_set_private() - set private data to tracecmd_input handle tracecmd_get_private() - get private data from tracecmd_input handle tracecmd_iterate_events() - iterate all events for a single buffer in a trace.dat file (can filter on CPUs) tracecmd_iterate_events_multi() - iterate all events from multiple buffers in a trace.dat file. (Does not filter on CPUs). tracecmd_filter_add() - Add a filter to a tracecmd_input handle that will filter the iterator funtions. tracecmd_filter_match() - Will test a record against a given filter to see if it matches or not. As change trace-cmd to use these functions instead of doing the same thing internally. Steven Rostedt (Google) (9): tracecmd: Use make variable instead of if statement for zlib test tracecmd library: Add tracecmd_iterate_events() tracecmd utest: Add test to test using the libraries to read tracecmd library: Add tracecmd_iterate_events_multi() trace-cmd library: Allow callers to save private data in tracecmd_input handlers trace-cmd report: Use tracecmd_iterate_events_multi() trace-cmd library: Add filtering logic for iterating events trace-cmd report: Make filter arguments match their files trace-cmd report: Use library tracecmd_filter_*() logic Makefile | 3 + include/trace-cmd/trace-cmd.h | 29 ++ lib/trace-cmd/Makefile | 7 +- lib/trace-cmd/include/trace-cmd-local.h | 5 + lib/trace-cmd/trace-filter.c | 197 ++++++++++ lib/trace-cmd/trace-input.c | 197 ++++++++++ tracecmd/Makefile | 6 +- tracecmd/trace-read.c | 466 ++++++++---------------- utest/Makefile | 4 +- utest/tracecmd-utest.c | 53 ++- 10 files changed, 650 insertions(+), 317 deletions(-) create mode 100644 lib/trace-cmd/trace-filter.c -- 2.35.1