Add a fillpolicy that can stall all writers?

9 views
Skip to first unread message

lh35344

unread,
Oct 12, 2025, 10:02:15 PM (9 days ago) Oct 12
to Perfetto Development - www.perfetto.dev
Hi, 

Currently we are using the c++ sdk to track some perf counters and quite often there can be quite a lot of data generated and written into external trace file. What we have observed is that the current BufferConfig only provides two types of fill policy, and none of those prioritise the integrity of the trace data (ie: no loss data or overwritten data). 

Is it possible to introduce a fill policy to BufferConfig  that is similar to the DataSource exhaust policy where we can opt to use something like a STALL_THEN_ABORT, where we at least will get notified that data loss has actually happened? 

Cheers

Lalit Maganti

unread,
Oct 12, 2025, 11:12:59 PM (8 days ago) Oct 12
to lh35344, Perfetto Development - www.perfetto.dev
Firstly, just want to make sure you've read this page of our docs: https://perfetto.dev/docs/concepts/buffers#debugging-data-losses

Now with that context: to confirm, are you seeing data loss in the shared memory buffer or in the central ring buffer?

In the shared memory, you have the option to use kStallAndAbort or kStallAndDrop as an option which prioritises integrity over performance. 

If you're talking about the central ring buffer: there are stats in the trace which tell you about loss: the suggestion would be to use RING_BUFFER + write_into_file (to avoid loss as much as possible) and then use `traced_buf_chunks_overwritten` as suggested by the docs to figure out whether data is lost or not. 

The architecture of Perfetto does not support introducing any other "stall" mode for the central ring buffer as this is optimized for many different processes to write into it in the general case.


--
You received this message because you are subscribed to the Google Groups "Perfetto Development - www.perfetto.dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perfetto-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/perfetto-dev/4183f918-c538-477c-bee0-2cc463a0b93an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages