1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * counter/counter-types.h
7 * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #ifndef _LTTNG_COUNTER_TYPES_H
11 #define _LTTNG_COUNTER_TYPES_H
13 #include <linux/types.h>
14 #include <linux/percpu.h>
15 #include <counter/config.h>
17 struct lib_counter_dimension
{
19 * Max. number of indexable elements.
23 * The stride for a dimension is the multiplication factor which
24 * should be applied to its index to take into account other
25 * dimensions nested inside.
30 struct lib_counter_layout
{
32 unsigned long *underflow_bitmap
;
33 unsigned long *overflow_bitmap
;
36 enum lib_counter_arithmetic
{
37 LIB_COUNTER_ARITHMETIC_MODULAR
,
38 LIB_COUNTER_ARITHMETIC_SATURATE
,
43 int64_t allocated_elem
;
44 struct lib_counter_dimension
*dimensions
;
45 enum lib_counter_arithmetic arithmetic
;
59 } global_sum_step
; /* 0 if unused */
60 struct lib_counter_config config
;
62 struct lib_counter_layout global_counters
;
63 struct lib_counter_layout __percpu
*percpu_counters
;
66 #endif /* _LTTNG_COUNTER_TYPES_H */