I think the below example should be also used in the tracecmd_open_head() man page. That's because the current example in tracecmd_open_head() is rather useless as nothing really can be done without the tracecmd_init_data() call. By using the below example in the tracecmd_open_head() page, it will show people a more informative way of using that call. Note, these man pages are already applied, any update should be done on top of the current repo. -- Steve On Wed, 23 Dec 2020 06:34:26 +0200 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > +EXAMPLE > +------- > +[source,c] > +-- > +#include <trace-cmd.h> > +... > +struct tracecmd_input *handle = tracecmd_open_head("trace.dat"); > + if (!handle) { > + /* Failed to open trace.dat file */ > + } > +... > +unsigned long long offset = 0; > +struct tep_record *rec; > +int cpu = 0; > + > + if (tracecmd_init_data(handle) < 0) { > + /* Failed to initialize hadle for reading the trace data */ > + } > + > + rec = tracecmd_read_cpu_first(handle, cpu); > + while (rec) { > + ... > + if ( /* some interesting record noticed */) { > + /* store the offset of the interesting record */ > + offset = rec->offset; > + } > + ... > + tracecmd_free_record(rec); > + rec = tracecmd_read_data(handle, cpu); > + } > + ... > + if (offset) { > + rec = tracecmd_read_at(handle, offset, &cpu); > + if (rec) { > + /* Got record at offset on cpu */ > + ... > + tracecmd_free_record(rec); > + } > + } > + > +... > + tracecmd_close(hadle); > +