Commit | Line | Data |
---|---|---|
ebabbf58 | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: MIT |
ebabbf58 MD |
3 | * |
4 | * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
5 | * | |
c0c0989a | 6 | * LTTng Counters API |
ebabbf58 MD |
7 | */ |
8 | ||
9 | #ifndef _LTTNG_COUNTER_H | |
10 | #define _LTTNG_COUNTER_H | |
11 | ||
12 | #include <stdint.h> | |
13 | #include <lttng/ust-config.h> | |
14 | #include "counter-types.h" | |
15 | ||
16 | /* max_nr_elem is for each dimension. */ | |
17 | struct lib_counter *lttng_counter_create(const struct lib_counter_config *config, | |
18 | size_t nr_dimensions, | |
19 | const size_t *max_nr_elem, | |
20 | int64_t global_sum_step, | |
21 | int global_counter_fd, | |
22 | int nr_counter_cpu_fds, | |
23 | const int *counter_cpu_fds, | |
1d18d519 MJ |
24 | bool is_daemon) |
25 | __attribute__((visibility("hidden"))); | |
ebabbf58 | 26 | |
1d18d519 MJ |
27 | void lttng_counter_destroy(struct lib_counter *counter) |
28 | __attribute__((visibility("hidden"))); | |
ddabe860 | 29 | |
1d18d519 MJ |
30 | int lttng_counter_set_global_shm(struct lib_counter *counter, int fd) |
31 | __attribute__((visibility("hidden"))); | |
ebabbf58 | 32 | |
1d18d519 MJ |
33 | int lttng_counter_set_cpu_shm(struct lib_counter *counter, int cpu, int fd) |
34 | __attribute__((visibility("hidden"))); | |
ddabe860 | 35 | |
1d18d519 MJ |
36 | int lttng_counter_get_global_shm(struct lib_counter *counter, int *fd, size_t *len) |
37 | __attribute__((visibility("hidden"))); | |
38 | ||
39 | int lttng_counter_get_cpu_shm(struct lib_counter *counter, int cpu, int *fd, size_t *len) | |
40 | __attribute__((visibility("hidden"))); | |
ebabbf58 | 41 | |
b187bcd5 MD |
42 | /* |
43 | * Has counter received all expected shm ? | |
44 | */ | |
45 | bool lttng_counter_ready(struct lib_counter *counter) | |
46 | __attribute__((visibility("hidden"))); | |
47 | ||
ebabbf58 MD |
48 | int lttng_counter_read(const struct lib_counter_config *config, |
49 | struct lib_counter *counter, | |
50 | const size_t *dimension_indexes, | |
51 | int cpu, int64_t *value, | |
1d18d519 MJ |
52 | bool *overflow, bool *underflow) |
53 | __attribute__((visibility("hidden"))); | |
ddabe860 | 54 | |
ebabbf58 MD |
55 | int lttng_counter_aggregate(const struct lib_counter_config *config, |
56 | struct lib_counter *counter, | |
57 | const size_t *dimension_indexes, | |
58 | int64_t *value, | |
1d18d519 MJ |
59 | bool *overflow, bool *underflow) |
60 | __attribute__((visibility("hidden"))); | |
ddabe860 | 61 | |
ebabbf58 MD |
62 | int lttng_counter_clear(const struct lib_counter_config *config, |
63 | struct lib_counter *counter, | |
1d18d519 MJ |
64 | const size_t *dimension_indexes) |
65 | __attribute__((visibility("hidden"))); | |
ebabbf58 MD |
66 | |
67 | #endif /* _LTTNG_COUNTER_H */ |