clock override: use getter API from LTTng-UST
[lttng-tools.git] / src / bin / lttng-sessiond / ust-clock.h
1 /*
2 * Copyright (C) 2010 Pierre-Marc Fournier
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 #ifndef _UST_CLOCK_H
10 #define _UST_CLOCK_H
11
12 #include <common/compat/time.h>
13 #include <sys/time.h>
14 #include <stdint.h>
15 #include <stddef.h>
16 #include <stdio.h>
17 #include <urcu/system.h>
18 #include <urcu/arch.h>
19 #include <lttng/ust-clock.h>
20
21 #include <common/uuid.h>
22
23 static __inline__
24 uint64_t trace_clock_read64(void)
25 {
26 uint64_t clock_value = 0;
27 lttng_ust_clock_read64_function read64_cb;
28
29 if (lttng_ust_trace_clock_get_read64_cb(&read64_cb)) {
30 goto end;
31 }
32
33 clock_value = read64_cb();
34 end:
35 return clock_value;
36 }
37
38 static __inline__
39 uint64_t trace_clock_freq(void)
40 {
41 uint64_t frequency = 0;
42 lttng_ust_clock_freq_function get_freq_cb;
43
44 if (lttng_ust_trace_clock_get_freq_cb(&get_freq_cb)) {
45 goto end;
46 }
47
48 frequency = get_freq_cb();
49 end:
50 return frequency;
51 }
52
53 static __inline__
54 int trace_clock_uuid(char *uuid)
55 {
56 int ret;
57 lttng_ust_clock_uuid_function get_uuid_cb;
58
59 if (lttng_ust_trace_clock_get_uuid_cb(&get_uuid_cb)) {
60 ret = -EINVAL;
61 goto end;
62 }
63
64 ret = get_uuid_cb(uuid);
65 end:
66 return ret;
67
68 }
69
70 static __inline__
71 const char *trace_clock_name(void)
72 {
73 const char *name;
74 lttng_ust_clock_name_function get_name_cb;
75
76 if (lttng_ust_trace_clock_get_name_cb(&get_name_cb)) {
77 name = NULL;
78 goto end;
79 }
80
81 name = get_name_cb();
82 end:
83 return name;
84 }
85
86 static __inline__
87 const char *trace_clock_description(void)
88 {
89 const char *description;
90 lttng_ust_clock_description_function get_description_cb;
91
92 if (lttng_ust_trace_clock_get_description_cb(&get_description_cb)) {
93 description = NULL;
94 goto end;
95 }
96
97 description = get_description_cb();
98 end:
99 return description;
100 }
101
102 #endif /* _UST_CLOCK_H */
This page took 0.030369 seconds and 4 git commands to generate.