Move to kernel style SPDX license identifiers
[lttng-ust.git] / libcounter / counter-types.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 Types
ebabbf58
MD
7 */
8
9#ifndef _LTTNG_COUNTER_TYPES_H
10#define _LTTNG_COUNTER_TYPES_H
11
12#include <stdint.h>
13#include <stddef.h>
14#include <stdbool.h>
15#include <sys/types.h>
16#include <lttng/counter-config.h>
17#include <lttng/ust-config.h>
18#include "shm_types.h"
19
20struct lib_counter_dimension {
21 /*
22 * Max. number of indexable elements.
23 */
24 size_t max_nr_elem;
25 /*
26 * The stride for a dimension is the multiplication factor which
27 * should be applied to its index to take into account other
28 * dimensions nested inside.
29 */
30 size_t stride;
31};
32
33struct lib_counter_layout {
34 void *counters;
35 unsigned long *overflow_bitmap;
36 unsigned long *underflow_bitmap;
37 int shm_fd;
38 size_t shm_len;
39 struct lttng_counter_shm_handle handle;
40};
41
42enum lib_counter_arithmetic {
43 LIB_COUNTER_ARITHMETIC_MODULAR,
44 LIB_COUNTER_ARITHMETIC_SATURATE,
45};
46
47struct lib_counter {
48 size_t nr_dimensions;
49 int64_t allocated_elem;
50 struct lib_counter_dimension *dimensions;
51 enum lib_counter_arithmetic arithmetic;
52 union {
53 struct {
54 int32_t max, min;
55 } limits_32_bit;
56 struct {
57 int64_t max, min;
58 } limits_64_bit;
59 } saturation;
60 union {
61 int8_t s8;
62 int16_t s16;
63 int32_t s32;
64 int64_t s64;
65 } global_sum_step; /* 0 if unused */
66 struct lib_counter_config config;
67
68 struct lib_counter_layout global_counters;
69 struct lib_counter_layout *percpu_counters;
70
71 bool is_daemon;
72 struct lttng_counter_shm_object_table *object_table;
73};
74
75#endif /* _LTTNG_COUNTER_TYPES_H */
This page took 0.024971 seconds and 4 git commands to generate.