how to continuously capture events
Lin Wang <[email protected]> Wed, 5 May 2021 08:21:35 -0400
| Newsgroups | org.kernel.vger.linux-trace-users |
|---|---|
| Message-ID | <CABPy0FmkQAJXiX=uQatisCCHsZpfpk78DA9GrNFfULTguiY_vQ@mail.gmail.com> |
Hi all, I'm new to ftrace and linux programming in general. Forgive me for asking dumb questions. I'm trying to continuously capture certain kernel events, convert them to a different format and then write them to a file. I understand that trace_pipe should be used for streaming. But I'm not sure how to read the content of trace_pipe at event boundary (I currently just read it to a temp buffer which would sometimes cut the last event in half). I discovered libtraceevent and libtracefs that I think are meant to help with this kind of tasks, so I'm reading the source code of trace-cmd to find examples. But so far the progress has been slow. Could anyone point me to the right direction, or advise me with a general outline of what I should do to achieve my task? Thanks, Lin