#include "ust-clock-class.hpp"
-#include <common/time.hpp>
#include <common/exception.hpp>
+#include <common/time.hpp>
#include <lttng/ust-clock.h>
-#define CLOCK_OFFSET_SAMPLE_COUNT 10
+#define CLOCK_OFFSET_SAMPLE_COUNT 10
namespace lst = lttng::sessiond::trace;
LTTNG_THROW_ERROR("Failed to parse UUID from string");
}
- return nonstd::optional<lttng_uuid>{uuid};
+ return nonstd::optional<lttng_uuid>{ uuid };
}
const char *sample_clock_name()
const auto name = get_name_cb();
if (!name) {
- LTTNG_THROW_ERROR("Invalid clock name returned by LTTng-UST `lttng_ust_clock_name_function`");
+ LTTNG_THROW_ERROR(
+ "Invalid clock name returned by LTTng-UST `lttng_ust_clock_name_function`");
}
return name;
const auto description = get_description_cb();
if (!description) {
- LTTNG_THROW_ERROR("Invalid clock description returned by LTTng-UST `lttng_ust_clock_description_function`");
+ LTTNG_THROW_ERROR(
+ "Invalid clock description returned by LTTng-UST `lttng_ust_clock_description_function`");
}
return description;
*/
void measure_single_clock_offset(struct offset_sample *sample)
{
- lst::clock_class::cycles_t monotonic_avg, monotonic[2], measure_delta,
- realtime;
+ lst::clock_class::cycles_t monotonic_avg, monotonic[2], measure_delta, realtime;
const auto tcf = sample_clock_frequency();
struct timespec rts = { 0, 0 };
if (tcf == NSEC_PER_SEC) {
realtime += rts.tv_nsec;
} else {
- realtime += (lst::clock_class::cycles_t) rts.tv_nsec * tcf /
- NSEC_PER_SEC;
+ realtime += (lst::clock_class::cycles_t) rts.tv_nsec * tcf / NSEC_PER_SEC;
}
sample->offset = (lst::clock_class::scycles_t) realtime - monotonic_avg;
* to complete, thus removing imprecision caused by preemption.
* May return a negative offset.
*/
-lst::clock_class::scycles_t measure_clock_offset(void)
+lst::clock_class::scycles_t measure_clock_offset()
{
struct offset_sample offset_best_sample = {
.offset = 0,
lttng::sessiond::ust::clock_class::clock_class() :
lst::clock_class(sample_clock_name(),
- sample_clock_description(),
- sample_clock_uuid(),
- measure_clock_offset(),
- sample_clock_frequency())
+ sample_clock_description(),
+ sample_clock_uuid(),
+ measure_clock_offset(),
+ sample_clock_frequency())
{
}