Move to kernel style SPDX license identifiers
[lttng-ust.git] / libcounter / counter.h
CommitLineData
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"
3d5db36a 15#include "helper.h"
ebabbf58
MD
16
17/* max_nr_elem is for each dimension. */
3d5db36a 18LTTNG_HIDDEN
ebabbf58
MD
19struct lib_counter *lttng_counter_create(const struct lib_counter_config *config,
20 size_t nr_dimensions,
21 const size_t *max_nr_elem,
22 int64_t global_sum_step,
23 int global_counter_fd,
24 int nr_counter_cpu_fds,
25 const int *counter_cpu_fds,
26 bool is_daemon);
3d5db36a 27LTTNG_HIDDEN
ebabbf58
MD
28void lttng_counter_destroy(struct lib_counter *counter);
29
3d5db36a 30LTTNG_HIDDEN
ebabbf58 31int lttng_counter_set_global_shm(struct lib_counter *counter, int fd);
3d5db36a 32LTTNG_HIDDEN
ebabbf58
MD
33int lttng_counter_set_cpu_shm(struct lib_counter *counter, int cpu, int fd);
34
3d5db36a 35LTTNG_HIDDEN
ebabbf58 36int lttng_counter_get_global_shm(struct lib_counter *counter, int *fd, size_t *len);
3d5db36a 37LTTNG_HIDDEN
ebabbf58
MD
38int lttng_counter_get_cpu_shm(struct lib_counter *counter, int cpu, int *fd, size_t *len);
39
3d5db36a 40LTTNG_HIDDEN
ebabbf58
MD
41int lttng_counter_read(const struct lib_counter_config *config,
42 struct lib_counter *counter,
43 const size_t *dimension_indexes,
44 int cpu, int64_t *value,
45 bool *overflow, bool *underflow);
3d5db36a 46LTTNG_HIDDEN
ebabbf58
MD
47int lttng_counter_aggregate(const struct lib_counter_config *config,
48 struct lib_counter *counter,
49 const size_t *dimension_indexes,
50 int64_t *value,
51 bool *overflow, bool *underflow);
3d5db36a 52LTTNG_HIDDEN
ebabbf58
MD
53int lttng_counter_clear(const struct lib_counter_config *config,
54 struct lib_counter *counter,
55 const size_t *dimension_indexes);
56
57#endif /* _LTTNG_COUNTER_H */
This page took 0.024601 seconds and 4 git commands to generate.