efficios / barectf

Generator of ANSI C tracers which output CTF data streams
https://barectf.org
MIT License
65 stars 17 forks source link

Close and flush packet even if packet_size was not reached #30

Open bogru8 opened 1 year ago

bogru8 commented 1 year ago

Hi,

I have a trace producer that runs continuously, and the number of trace events is not known. (I also use two buffers for traces, and switch them inside close_packet.) I tried to call close_packet when I want to flush the buffer (i.e. from time to time, even if the initial provided buffer is not yet filled). But the generated file is not ok, since it seems that packet size, stored inside packet header, is not the real size of the packet filled up to that point, but the initially provided buffer size.

Is there a way to achieve this deterministic close/flush of packets at certain moments, or just when the buffer is filled or platform_fini called?