trace-cmd library: Refactor the logic for writing trace data in the file

Refactored the internal logic of tracecmd_write_cpu_data() API to be
suitable for upcoming trace file format changes and data compression.
The size and the offset of the trace data is saved in the file right
after the data is written. The old logic calculates the size and offset
in advance, but when the trace data is compressed it is hard to use
that approach.

Link: https://lore.kernel.org/linux-trace-devel/20211111150805.86419-3-tz.stoyanov@gmail.com
Link: https://lore.kernel.org/linux-trace-devel/20211111150805.86419-4-tz.stoyanov@gmail.com
Link: https://lore.kernel.org/linux-trace-devel/20211111150805.86419-5-tz.stoyanov@gmail.com

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
[ Merged the above three links into one ]
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
5 files changed