Re: [PATCH V2 00/10] perf script: Add API for filtering via dynamically loaded shared object

From: Andi Kleen
Date: Sun Jun 27 2021 - 12:13:25 EST



On 6/27/2021 6:18 AM, Adrian Hunter wrote:
Hi
In some cases, users want to filter very large amounts of data (e.g. from
AUX area tracing like Intel PT) looking for something specific. While
scripting such as Python can be used, Python is 10 to 20 times slower than
C. So define a C API so that custom filters can be written and loaded.

While I appreciate this for complex cases, in my experience filtering is usually just a simple expression. It would be nice to also have a way to do this reasonably fast without having to write a custom C file.   Is the 10x-20x overhead just the python interpreter, or is it related to perf? Maybe we could have some kind of python fast path just for filters? Or maybe the alternative would be to have a frontend in perf that can automatically generate/compile such a C filter based on a simple expression, but I'm not sure if that would be much simpler.

-Andi