On 27/06/21 7:13 pm, Andi Kleen wrote:
On 6/27/2021 6:18 AM, Adrian Hunter wrote:I do not agree that writing C filters is a hassle e.g. a minimal do-nothing
Hi In some cases, users want to filter very large amounts of dataWhile I appreciate this for complex cases, in my experience filtering
(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.
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
filter is only a few lines:
Maybe we could have some kind of python fast pathI expect there are ways to make it more efficient, but I doubt it would ever
just for filters?
come close to C.
just for filters? Or maybe the alternative would be to have aIf gcc is available, perf script could, in fact, build the .so on the fly
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.
since the compile time is very quick.
Another point is that filters can be used for more than just filtering.
Here is an example which sums cycles per-cpu and prints them, and the difference
to the last print, at the beginning of each line. I think this was something
you were interested in doing?