X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-clock.hpp;h=7b9034173b34ba861680104b3d89c8ba8149262e;hb=b3647fb885288c63d21478ea9a9c85685bc5c5f2;hp=3807f40a3127c5348c26d6222ed8abfc81264b55;hpb=328c2fe7297c941aa9cbcfa4ce944fca1bd7300f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-clock.hpp b/src/bin/lttng-sessiond/ust-clock.hpp index 3807f40a3..7b9034173 100644 --- a/src/bin/lttng-sessiond/ust-clock.hpp +++ b/src/bin/lttng-sessiond/ust-clock.hpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2010 Pierre-Marc Fournier * Copyright (C) 2011 Mathieu Desnoyers + * Copyright (C) 2022 Jérémie Galarneau * * SPDX-License-Identifier: GPL-2.0-only * @@ -10,93 +11,36 @@ #define _UST_CLOCK_H #include -#include -#include +#include +#include + +#include #include +#include #include -#include +#include +#include #include -#include - -#include - -static __inline__ -uint64_t trace_clock_read64(void) -{ - uint64_t clock_value = 0; - lttng_ust_clock_read64_function read64_cb; - - if (lttng_ust_trace_clock_get_read64_cb(&read64_cb)) { - goto end; - } - - clock_value = read64_cb(); -end: - return clock_value; -} - -static __inline__ -uint64_t trace_clock_freq(void) -{ - uint64_t frequency = 0; - lttng_ust_clock_freq_function get_freq_cb; - - if (lttng_ust_trace_clock_get_freq_cb(&get_freq_cb)) { - goto end; - } - - frequency = get_freq_cb(); -end: - return frequency; -} - -static __inline__ -int trace_clock_uuid(char *uuid) -{ - int ret; - lttng_ust_clock_uuid_function get_uuid_cb; - - if (lttng_ust_trace_clock_get_uuid_cb(&get_uuid_cb)) { - ret = -EINVAL; - goto end; - } - - ret = get_uuid_cb(uuid); -end: - return ret; - -} - -static __inline__ -const char *trace_clock_name(void) -{ - const char *name; - lttng_ust_clock_name_function get_name_cb; +#include - if (lttng_ust_trace_clock_get_name_cb(&get_name_cb)) { - name = NULL; - goto end; - } +namespace lttng { +namespace ust { - name = get_name_cb(); -end: - return name; -} +class clock_attributes_sample { +public: + using cycles_t = uint64_t; + using scycles_t = int64_t; -static __inline__ -const char *trace_clock_description(void) -{ - const char *description; - lttng_ust_clock_description_function get_description_cb; + clock_attributes_sample(); - if (lttng_ust_trace_clock_get_description_cb(&get_description_cb)) { - description = NULL; - goto end; - } + const std::string _name; + const std::string _description; + const nonstd::optional _uuid; + const scycles_t _offset; + const cycles_t _frequency; +}; - description = get_description_cb(); -end: - return description; -} +} /* namespace ust */ +} /* namespace lttng */ #endif /* _UST_CLOCK_H */