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