[lttng-dev] lttng snapshots and running traces

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Thu Sep 26 11:57:18 EDT 2013

Date: Thu, 26 Sep 2013 11:18:19 -0400
From: Julien Desfossez <jdesfossez at efficios.com>

> When we issue the "snapshot record" command, the consumer takes the current reading and writing positions in the ring-buffer, 
> and will only try to consume the data between these boundaries. It will start at the reading position and consume subbuffer by 
> subbuffer up to the writing position. Unlike in a normal tracing session, the reading position is not pushed by the consumer, it is 
> pushed by the tracer, it corresponds to the last subbuffer not yet reused (or 0 before the first ring-buffer wrap-up).
> If the tracer is quickly filling up subbuffers and we don't have enough subbuffers (or they are too small) to give us enough time 
> to extract them, they will be overridden (default mode in snapshot mode) and we will skip these subbuffers.
> So there is no race between the consumer and tracer, we rely on the absolute position (free-running counter) and we detect 
> and skip if a subbuffer has been reused.

   Thanks for these clarifications.  It's quite clear that, unless the tracer is quiescent, a snapshot can never be as large as the sum of 
the sub-buffers.

   One last point, then: let's suppose the consumer is busy reading records from a certain sub-buffer when the tracer catches up to 
it and grabs the same sub-buffer.  I suppose the consumer is overrun roughshod?  Does this happen at the sub-buffer level or 
when the tracer's position within the sub-buffer catches up to the reader's?  The consumer's read operation is interrupted and 
fails (or does the current read conclude, then the next read request fails?), so it tries to skip ahead to the next sub-buffer.  The 
consumer then keeps skipping until its read position passes the tracer's write position (or it reaches the last "scheduled" 
sub-buffer).  So the snapshot ends up having a series of gaps near its end (assuming the consumer gets to read a few records 
from each sub-buffer before the tracer kicks it ahead).  Right?

Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence R&D Canada - Valcartier (DRDC Valcartier)
2459 route de la Bravoure
Québec QC  G3J 1X5
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada

More information about the lttng-dev mailing list