c or c++ access trace_processor_shell
Hi,
There are python API to decode and query trace file base on trace_processor_shell/trace_processor_shell.exe , do you have any way to access trace_processor_shell by c or c++ (our performance tool write by c++) or have any refer information about how to do this.
Thanks.
Fundamentally at the very heart of everything trace processor is a c++ library with the following API: https://github.com/google/perfetto/blob/main/include/perfetto/trace_processor/trace_processor.h. So yes it is theoretically possible.
The main problem here is build system integration: we don't have any helpers to help you embed the library in a C++ project so you'd have to handroll something yourself.
Another option is that you use trace processor's rpc layer and communicate via stdio/http (which is what the Python API is also doing under the hood).
Both of these solutions will require some non-trivial work on your side to integrate properly.
The simplest, zero effort option would be to just fork/exec the snell binary from your tool. But that obviously has performance downsides. May work through depending on what you want to do.