[lttng-dev] lttng snapshots and running traces

Julien Desfossez jdesfossez at efficios.com
Thu Sep 26 16:10:51 EDT 2013

On 13-09-26 04:06 PM, Thibault, Daniel wrote:
> Envoyé : 26 septembre 2013 15:55
>>>    If the tracers pass the consumer, and then the consumer passes the 
>>> tracers, does the consumer stop copying the buffer contents to the snapshot trace?
>>> * consumer reads a number of "pass n" sub-buffers (where n is the number of times the tracers have gone around)
>>> * tracers catch up with the consumer, skip ahead, write at least one whole "pass n+1" sub-buffer
>>> * tracers then stop or slow down
>>> * consumer reads the "pass n+1" sub-buffer(s), then overtakes the tracers
>>> * consumer skips over the sub-buffer where the tracers are, finds a "pass n" sub-buffer
>>>    If the consumer doesn't close the trace at that point, it would corrupt the snapshot.
>> The consumer reads absolute positions in the ring-buffer, if a subbuffer has been overwritten, it skips to the next until it reaches its end position.
>> The consumer will never read data that has been recorded after it started taking the snapshot.
>> That is why it is important to know that we deal with absolute positions.
>> Is that clearer ?
>> If you want to take a look, the code for the kernel is in the function lttng_kconsumer_snapshot_channel in src/common/kernel-consumer/kernel-consumer.c.
>> You will see that we take the begin and end positions, and then iterate subbuffer by subbuffer, if a get_subbuff(absolute_position) fails it means it has already been reused and we > skip to the next.
>> Julien
>    I think I get it now: the consumer skips the "pass n+1" sub-buffers and reads only the "pass n" sub-buffers it encounters during its sweep.  Thanks!
Yes, exactly :-) !


> 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
> <http://www.valcartier.drdc-rddc.gc.ca/>

More information about the lttng-dev mailing list