trace-cmd: Add new tracecmd_set_cursor() function
The tracecmd_set_cursor() takes an offset that will cause the next
tracecmd_peek_data() or tracecmd_read_data() to return a record at
that offset (given that the CPU matches). This is useful when
iterating with tracecmd_read_data() and then needing to read a
record out of sequence. One can do:
while ((record = tracecmd_read_data(h, cpu))) {
/* ... */
free_record(record);
record = tracecmd_peek_data(h, cpu);
save_offset = record->offset;
free_record(record);
record = tracecmd_read_at(h, o, NULL);
/* ... */
tracecmd_set_cursor(h, cpu, save_offset);
}
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2 files changed