[lttng-dev] LTTng timestamp from NTP ( Network transfer protocol)

Jérémie Galarneau jeremie.galarneau at efficios.com
Mon Mar 9 13:45:36 EDT 2015


On Tue, Mar 3, 2015 at 2:10 AM, Divya Vyas <dvyas at mvista.com> wrote:
>
> Hi,
>
> I am looking at synchronization of traces from guest and host according to timestamps.
>
> Does LTTng uses timestamps generated from NTP (Network transfer protocol) ?
> How I can use NTP to synchronize the timestamps of guest and host ?
>

Hi Divya,

As you may know, events produced by LTTng (both UST and kernel
tracers) are timestamped using the clock_gettime() "CLOCK_MONOTONIC"
clock. From the clock_gettime() man page[1]:

CLOCK_MONOTONIC
              Clock that cannot be set and  represents  monotonic  time
              since some unspecified starting point.  This clock is not
              affected by discontinuous jumps in the system time (e.g.,
              if  the system administrator manually changes the clock),
              but is affected by the incremental adjustments  performed
              by adjtime(3) and NTP.

In this regard, LTTng does not use NTP directly and relies on this
behavior to account for small corrections due to inevitable clock
drifts.

However, the clock attributes (such as the monotonic timestamp's
offset from Epoch) are sampled when tracing starts. This means that
you should make sure that all systems' time has been corrected by NTP
before starting tracing sessions. This way, it should be possible to
correlate traces within NTP's precision.

To correlate multiple traces with different clocks, have a look at
Babeltrace's --clock-force-correlate option. I'm not sure about Trace
Compass, cc-ing Alexandre Montplaisir.

Regards,
Jérémie

[1] http://manpages.ubuntu.com/manpages/trusty/man2/clock_gettime.2.html

>
> Thanks,
> Divya Vyas
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list