SoW-2020-0002: Trace Hit Counters
[deliverable/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>
bb84a1ec 13#include <stdbool.h>
ebabbf58
MD
14#include <lttng/ust-config.h>
15#include "counter-types.h"
3d5db36a 16#include "helper.h"
ebabbf58
MD
17
18/* max_nr_elem is for each dimension. */
3d5db36a 19LTTNG_HIDDEN
ebabbf58
MD
20struct lib_counter *lttng_counter_create(const struct lib_counter_config *config,
21 size_t nr_dimensions,
22 const size_t *max_nr_elem,
23 int64_t global_sum_step,
24 int global_counter_fd,
25 int nr_counter_cpu_fds,
26 const int *counter_cpu_fds,
27 bool is_daemon);
3d5db36a 28LTTNG_HIDDEN
ebabbf58
MD
29void lttng_counter_destroy(struct lib_counter *counter);
30
3d5db36a 31LTTNG_HIDDEN
ebabbf58 32int lttng_counter_set_global_shm(struct lib_counter *counter, int fd);
3d5db36a 33LTTNG_HIDDEN
ebabbf58
MD
34int lttng_counter_set_cpu_shm(struct lib_counter *counter, int cpu, int fd);
35
3d5db36a 36LTTNG_HIDDEN
ebabbf58 37int lttng_counter_get_global_shm(struct lib_counter *counter, int *fd, size_t *len);
3d5db36a 38LTTNG_HIDDEN
ebabbf58
MD
39int lttng_counter_get_cpu_shm(struct lib_counter *counter, int cpu, int *fd, size_t *len);
40
bb84a1ec
MD
41/*
42 * Has counter received all expected shm ?
43 */
44LTTNG_HIDDEN
45bool lttng_counter_ready(struct lib_counter *counter);
46
3d5db36a 47LTTNG_HIDDEN
ebabbf58
MD
48int 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,
52 bool *overflow, bool *underflow);
3d5db36a 53LTTNG_HIDDEN
ebabbf58
MD
54int lttng_counter_aggregate(const struct lib_counter_config *config,
55 struct lib_counter *counter,
56 const size_t *dimension_indexes,
57 int64_t *value,
58 bool *overflow, bool *underflow);
3d5db36a 59LTTNG_HIDDEN
ebabbf58
MD
60int lttng_counter_clear(const struct lib_counter_config *config,
61 struct lib_counter *counter,
62 const size_t *dimension_indexes);
63
64#endif /* _LTTNG_COUNTER_H */
This page took 0.026511 seconds and 5 git commands to generate.