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.