| 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 | /* |
| 20 | * Set clock override read callback. This callback should return the |
| 21 | * current clock time (a 64-bit monotonic counter). |
| 22 | */ |
| 23 | int lttng_ust_trace_clock_set_read64_cb(uint64_t (*read64)(void)); |
| 24 | |
| 25 | /* |
| 26 | * Set clock override frequency callback. This callback should return |
| 27 | * the frequency of the clock in cycles per second. |
| 28 | */ |
| 29 | int lttng_ust_trace_clock_set_freq_cb(uint64_t (*freq)(void)); |
| 30 | |
| 31 | /* |
| 32 | * Set clock override unique identifier. |
| 33 | * LTTNG_UST_UUID_STR_LEN is the maximum length of uuid string. Includes |
| 34 | * final \0. |
| 35 | */ |
| 36 | #define LTTNG_UST_UUID_STR_LEN 37 |
| 37 | |
| 38 | int lttng_ust_trace_clock_set_uuid_cb(int (*uuid)(char *uuid)); |
| 39 | |
| 40 | /* |
| 41 | * Set clock override name. |
| 42 | */ |
| 43 | int lttng_ust_trace_clock_set_name_cb(const char *(*name)(void)); |
| 44 | |
| 45 | /* |
| 46 | * Set clock override description. |
| 47 | */ |
| 48 | int lttng_ust_trace_clock_set_description_cb(const char *(*description)(void)); |
| 49 | |
| 50 | /* |
| 51 | * Use the clock override rather than the default clock. |
| 52 | */ |
| 53 | int lttng_ust_enable_trace_clock_override(void); |
| 54 | |
| 55 | #endif /* LTTNG_UST_CLOCK_H */ |