common: credentials: hide symbols
[lttng-tools.git] / src / bin / lttng-sessiond / ust-clock.h
CommitLineData
d0b96690 1/*
ab5be9fa
MJ
2 * Copyright (C) 2010 Pierre-Marc Fournier
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
d0b96690 4 *
ab5be9fa 5 * SPDX-License-Identifier: GPL-2.0-only
d0b96690 6 *
d0b96690
DG
7 */
8
9#ifndef _UST_CLOCK_H
10#define _UST_CLOCK_H
11
389fbf04 12#include <common/compat/time.h>
d0b96690
DG
13#include <sys/time.h>
14#include <stdint.h>
15#include <stddef.h>
16#include <stdio.h>
fc0bb9fa
MD
17#include <urcu/system.h>
18#include <urcu/arch.h>
19#include <lttng/ust-clock.h>
d0b96690 20
c70636a7 21#include <common/uuid.h>
d0b96690 22
d0b96690 23static __inline__
97f3d71c 24uint64_t trace_clock_read64(void)
d0b96690 25{
97f3d71c
MD
26 uint64_t clock_value = 0;
27 lttng_ust_clock_read64_function read64_cb;
d0b96690 28
97f3d71c
MD
29 if (lttng_ust_trace_clock_get_read64_cb(&read64_cb)) {
30 goto end;
1cf9656c 31 }
d0b96690 32
97f3d71c
MD
33 clock_value = read64_cb();
34end:
35 return clock_value;
d0b96690
DG
36}
37
38static __inline__
97f3d71c 39uint64_t trace_clock_freq(void)
d0b96690 40{
97f3d71c
MD
41 uint64_t frequency = 0;
42 lttng_ust_clock_freq_function get_freq_cb;
43
44 if (lttng_ust_trace_clock_get_freq_cb(&get_freq_cb)) {
d0b96690
DG
45 goto end;
46 }
fc0bb9fa 47
97f3d71c
MD
48 frequency = get_freq_cb();
49end:
50 return frequency;
fc0bb9fa
MD
51}
52
53static __inline__
97f3d71c 54int trace_clock_uuid(char *uuid)
fc0bb9fa 55{
97f3d71c
MD
56 int ret;
57 lttng_ust_clock_uuid_function get_uuid_cb;
fc0bb9fa 58
97f3d71c
MD
59 if (lttng_ust_trace_clock_get_uuid_cb(&get_uuid_cb)) {
60 ret = -EINVAL;
61 goto end;
fc0bb9fa 62 }
fc0bb9fa 63
97f3d71c
MD
64 ret = get_uuid_cb(uuid);
65end:
66 return ret;
fc0bb9fa 67
fc0bb9fa
MD
68}
69
70static __inline__
71const char *trace_clock_name(void)
72{
97f3d71c
MD
73 const char *name;
74 lttng_ust_clock_name_function get_name_cb;
fc0bb9fa 75
97f3d71c
MD
76 if (lttng_ust_trace_clock_get_name_cb(&get_name_cb)) {
77 name = NULL;
78 goto end;
fc0bb9fa 79 }
97f3d71c
MD
80
81 name = get_name_cb();
82end:
83 return name;
fc0bb9fa
MD
84}
85
86static __inline__
87const char *trace_clock_description(void)
88{
97f3d71c
MD
89 const char *description;
90 lttng_ust_clock_description_function get_description_cb;
fc0bb9fa 91
97f3d71c
MD
92 if (lttng_ust_trace_clock_get_description_cb(&get_description_cb)) {
93 description = NULL;
94 goto end;
fc0bb9fa 95 }
97f3d71c
MD
96
97 description = get_description_cb();
98end:
99 return description;
fc0bb9fa
MD
100}
101
d0b96690 102#endif /* _UST_CLOCK_H */
This page took 0.058745 seconds and 4 git commands to generate.