In the upcoming 2.8, we can print the negative value of clock offset in
the metadata, and expect users to update their viewers to correct any
bug that could prevent them from handling those negative values.
This happens only in cases where the system sets CLOCK_REALTIME to 0
after boot, thus leading to a negative clock offset value between
realtime and monotonic clocks.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* the REALTIME clock to 0 after boot.
*/
static
* the REALTIME clock to 0 after boot.
*/
static
-uint64_t measure_clock_offset(void)
+int64_t measure_clock_offset(void)
{
uint64_t monotonic_avg, monotonic[2], realtime;
uint64_t tcf = trace_clock_freq();
{
uint64_t monotonic_avg, monotonic[2], realtime;
uint64_t tcf = trace_clock_freq();
realtime += n;
}
offset = (int64_t) realtime - monotonic_avg;
realtime += n;
}
offset = (int64_t) realtime - monotonic_avg;
- if (offset < 0)
- return 0;
" description = \"%s\";\n"
" freq = %llu; /* Frequency, in Hz */\n"
" /* clock value offset from Epoch is: offset * (1/freq) */\n"
" description = \"%s\";\n"
" freq = %llu; /* Frequency, in Hz */\n"
" /* clock value offset from Epoch is: offset * (1/freq) */\n"
"};\n\n",
trace_clock_description(),
(unsigned long long) trace_clock_freq(),
"};\n\n",
trace_clock_description(),
(unsigned long long) trace_clock_freq(),
- (unsigned long long) measure_clock_offset()
+ (long long) measure_clock_offset()