| 1 | #ifndef LTTNG_UST_CLOCK_H |
| 2 | #define LTTNG_UST_CLOCK_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; version 2.1 of |
| 10 | * the License. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <stdint.h> |
| 23 | #include <stddef.h> |
| 24 | |
| 25 | /* |
| 26 | * Set each callback for the trace clock override, and then enable the |
| 27 | * override. Those functions return negative error values on error, 0 on |
| 28 | * success. |
| 29 | */ |
| 30 | |
| 31 | /* |
| 32 | * Set clock override read callback. This callback should return the |
| 33 | * current clock time (a 64-bit monotonic counter). |
| 34 | */ |
| 35 | int lttng_ust_trace_clock_set_read64_cb(uint64_t (*read64)(void)); |
| 36 | |
| 37 | /* |
| 38 | * Set clock override frequency callback. This callback should return |
| 39 | * the frequency of the clock in cycles per second. |
| 40 | */ |
| 41 | int lttng_ust_trace_clock_set_freq_cb(uint64_t (*freq)(void)); |
| 42 | |
| 43 | /* |
| 44 | * Set clock override unique identifier. |
| 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 | |
| 50 | int lttng_ust_trace_clock_set_uuid_cb(int (*uuid)(char *uuid)); |
| 51 | |
| 52 | /* |
| 53 | * Set clock override name. |
| 54 | */ |
| 55 | int lttng_ust_trace_clock_set_name_cb(const char *(*name)(void)); |
| 56 | |
| 57 | /* |
| 58 | * Set clock override description. |
| 59 | */ |
| 60 | int lttng_ust_trace_clock_set_description_cb(const char *(*description)(void)); |
| 61 | |
| 62 | /* |
| 63 | * Use the clock override rather than the default clock. |
| 64 | */ |
| 65 | int lttng_ust_enable_trace_clock_override(void); |
| 66 | |
| 67 | #endif /* LTTNG_UST_CLOCK_H */ |