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