X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Flttng%2Fust-clock.h;h=a5b7176d4828dd50e43f07c025dc0b24953dc543;hb=81b2d23800224648edd5850dd43b78d00b668a5e;hp=52455a612265e70571da6932ad0474f29df9c45a;hpb=ded1a8085555af5c749959bf6a2f3bc758e04669;p=lttng-ust.git diff --git a/include/lttng/ust-clock.h b/include/lttng/ust-clock.h index 52455a61..a5b7176d 100644 --- a/include/lttng/ust-clock.h +++ b/include/lttng/ust-clock.h @@ -1,67 +1,74 @@ -#ifndef LTTNG_UST_CLOCK_H -#define LTTNG_UST_CLOCK_H - /* - * Copyright (C) 2014 Mathieu Desnoyers + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; version 2.1 of - * the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (C) 2014 Mathieu Desnoyers */ +#ifndef LTTNG_UST_CLOCK_H +#define LTTNG_UST_CLOCK_H + #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Set each callback for the trace clock override, and then enable the * override. Those functions return negative error values on error, 0 on * success. */ +typedef uint64_t (*lttng_ust_clock_read64_function)(void); +typedef uint64_t (*lttng_ust_clock_freq_function)(void); +typedef int (*lttng_ust_clock_uuid_function)(char *uuid); +typedef const char *(*lttng_ust_clock_name_function)(void); +typedef const char *(*lttng_ust_clock_description_function)(void); + /* - * Set clock override read callback. This callback should return the + * Set/Get clock override read callback. This callback should return the * current clock time (a 64-bit monotonic counter). */ -int lttng_ust_trace_clock_set_read64_cb(uint64_t (*read64)(void)); +int lttng_ust_trace_clock_set_read64_cb(lttng_ust_clock_read64_function read64_cb); +int lttng_ust_trace_clock_get_read64_cb(lttng_ust_clock_read64_function *read64_cb); /* - * Set clock override frequency callback. This callback should return + * Set/Get clock override frequency callback. This callback should return * the frequency of the clock in cycles per second. */ -int lttng_ust_trace_clock_set_freq_cb(uint64_t (*freq)(void)); +int lttng_ust_trace_clock_set_freq_cb(lttng_ust_clock_freq_function freq_cb); +int lttng_ust_trace_clock_get_freq_cb(lttng_ust_clock_freq_function *freq_cb); /* - * Set clock override unique identifier. + * Set/Get clock override unique identifier. * LTTNG_UST_UUID_STR_LEN is the maximum length of uuid string. Includes * final \0. */ #define LTTNG_UST_UUID_STR_LEN 37 -int lttng_ust_trace_clock_set_uuid_cb(int (*uuid)(char *uuid)); +int lttng_ust_trace_clock_set_uuid_cb(lttng_ust_clock_uuid_function uuid_cb); +int lttng_ust_trace_clock_get_uuid_cb(lttng_ust_clock_uuid_function *uuid_cb); /* - * Set clock override name. + * Set/Get clock override name. */ -int lttng_ust_trace_clock_set_name_cb(const char *(*name)(void)); +int lttng_ust_trace_clock_set_name_cb(lttng_ust_clock_name_function name_cb); +int lttng_ust_trace_clock_get_name_cb(lttng_ust_clock_name_function *name_cb); /* - * Set clock override description. + * Set/Get clock override description. */ -int lttng_ust_trace_clock_set_description_cb(const char *(*description)(void)); +int lttng_ust_trace_clock_set_description_cb(lttng_ust_clock_description_function description_cb); +int lttng_ust_trace_clock_get_description_cb(lttng_ust_clock_description_function *description_cb); /* * Use the clock override rather than the default clock. */ int lttng_ust_enable_trace_clock_override(void); +#ifdef __cplusplus +} +#endif + #endif /* LTTNG_UST_CLOCK_H */