2 * counter/counter-types.h
6 * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #ifndef _LTTNG_COUNTER_TYPES_H
28 #define _LTTNG_COUNTER_TYPES_H
33 #include <sys/types.h>
34 #include <lttng/counter-config.h>
35 #include <lttng/ust-config.h>
36 #include "shm_types.h"
38 struct lib_counter_dimension
{
40 * Max. number of indexable elements.
44 * The stride for a dimension is the multiplication factor which
45 * should be applied to its index to take into account other
46 * dimensions nested inside.
51 struct lib_counter_layout
{
53 unsigned long *overflow_bitmap
;
54 unsigned long *underflow_bitmap
;
57 struct lttng_counter_shm_handle handle
;
60 enum lib_counter_arithmetic
{
61 LIB_COUNTER_ARITHMETIC_MODULAR
,
62 LIB_COUNTER_ARITHMETIC_SATURATE
,
67 int64_t allocated_elem
;
68 struct lib_counter_dimension
*dimensions
;
69 enum lib_counter_arithmetic arithmetic
;
83 } global_sum_step
; /* 0 if unused */
84 struct lib_counter_config config
;
86 struct lib_counter_layout global_counters
;
87 struct lib_counter_layout
*percpu_counters
;
90 struct lttng_counter_shm_object_table
*object_table
;
93 #endif /* _LTTNG_COUNTER_TYPES_H */