Commit | Line | Data |
---|---|---|
1c196845 MJ |
1 | // SPDX-FileCopyrightText: 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
2 | // | |
3 | // SPDX-License-Identifier: LGPL-2.1-only | |
ded1a808 | 4 | |
c0c0989a MJ |
5 | #ifndef LTTNG_UST_CLOCK_H |
6 | #define LTTNG_UST_CLOCK_H | |
7 | ||
ded1a808 MD |
8 | #include <stdint.h> |
9 | #include <stddef.h> | |
10 | ||
81b2d238 SM |
11 | #ifdef __cplusplus |
12 | extern "C" { | |
13 | #endif | |
14 | ||
ded1a808 MD |
15 | /* |
16 | * Set each callback for the trace clock override, and then enable the | |
17 | * override. Those functions return negative error values on error, 0 on | |
18 | * success. | |
19 | */ | |
20 | ||
33b563d6 MD |
21 | typedef uint64_t (*lttng_ust_clock_read64_function)(void); |
22 | typedef uint64_t (*lttng_ust_clock_freq_function)(void); | |
23 | typedef int (*lttng_ust_clock_uuid_function)(char *uuid); | |
24 | typedef const char *(*lttng_ust_clock_name_function)(void); | |
25 | typedef const char *(*lttng_ust_clock_description_function)(void); | |
26 | ||
ded1a808 | 27 | /* |
33b563d6 | 28 | * Set/Get clock override read callback. This callback should return the |
ded1a808 MD |
29 | * current clock time (a 64-bit monotonic counter). |
30 | */ | |
33b563d6 MD |
31 | int lttng_ust_trace_clock_set_read64_cb(lttng_ust_clock_read64_function read64_cb); |
32 | int lttng_ust_trace_clock_get_read64_cb(lttng_ust_clock_read64_function *read64_cb); | |
ded1a808 MD |
33 | |
34 | /* | |
33b563d6 | 35 | * Set/Get clock override frequency callback. This callback should return |
ded1a808 MD |
36 | * the frequency of the clock in cycles per second. |
37 | */ | |
33b563d6 MD |
38 | int lttng_ust_trace_clock_set_freq_cb(lttng_ust_clock_freq_function freq_cb); |
39 | int lttng_ust_trace_clock_get_freq_cb(lttng_ust_clock_freq_function *freq_cb); | |
ded1a808 MD |
40 | |
41 | /* | |
33b563d6 | 42 | * Set/Get clock override unique identifier. |
ded1a808 MD |
43 | * LTTNG_UST_UUID_STR_LEN is the maximum length of uuid string. Includes |
44 | * final \0. | |
45 | */ | |
46 | #define LTTNG_UST_UUID_STR_LEN 37 | |
47 | ||
33b563d6 MD |
48 | int lttng_ust_trace_clock_set_uuid_cb(lttng_ust_clock_uuid_function uuid_cb); |
49 | int lttng_ust_trace_clock_get_uuid_cb(lttng_ust_clock_uuid_function *uuid_cb); | |
ded1a808 MD |
50 | |
51 | /* | |
33b563d6 | 52 | * Set/Get clock override name. |
ded1a808 | 53 | */ |
33b563d6 MD |
54 | int lttng_ust_trace_clock_set_name_cb(lttng_ust_clock_name_function name_cb); |
55 | int lttng_ust_trace_clock_get_name_cb(lttng_ust_clock_name_function *name_cb); | |
ded1a808 MD |
56 | |
57 | /* | |
33b563d6 | 58 | * Set/Get clock override description. |
ded1a808 | 59 | */ |
33b563d6 MD |
60 | int lttng_ust_trace_clock_set_description_cb(lttng_ust_clock_description_function description_cb); |
61 | int lttng_ust_trace_clock_get_description_cb(lttng_ust_clock_description_function *description_cb); | |
ded1a808 MD |
62 | |
63 | /* | |
64 | * Use the clock override rather than the default clock. | |
65 | */ | |
66 | int lttng_ust_enable_trace_clock_override(void); | |
67 | ||
81b2d238 SM |
68 | #ifdef __cplusplus |
69 | } | |
70 | #endif | |
71 | ||
ded1a808 | 72 | #endif /* LTTNG_UST_CLOCK_H */ |