2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2010 Pierre-Marc Fournier
5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
16 #include <urcu/system.h>
17 #include <urcu/arch.h>
18 #include <lttng/ust-clock.h>
20 #include "lttng-ust-uuid.h"
22 struct lttng_ust_trace_clock
{
23 uint64_t (*read64
)(void);
24 uint64_t (*freq
)(void);
25 int (*uuid
)(char *uuid
);
26 const char *(*name
)(void);
27 const char *(*description
)(void);
30 __attribute__((visibility("hidden")))
31 extern struct lttng_ust_trace_clock
*lttng_ust_trace_clock
;
33 void lttng_ust_clock_init(void);
35 /* Use the kernel MONOTONIC clock. */
38 uint64_t trace_clock_read64_monotonic(void)
42 if (caa_unlikely(clock_gettime(CLOCK_MONOTONIC
, &ts
))) {
46 return ((uint64_t) ts
.tv_sec
* 1000000000ULL) + ts
.tv_nsec
;
50 uint64_t trace_clock_read64(void)
52 struct lttng_ust_trace_clock
*ltc
= CMM_LOAD_SHARED(lttng_ust_trace_clock
);
54 if (caa_likely(!ltc
)) {
55 return trace_clock_read64_monotonic();
57 cmm_read_barrier_depends(); /* load ltc before content */
62 #endif /* _UST_CLOCK_H */
This page took 0.03397 seconds and 4 git commands to generate.