X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fcounter%2Fcounter-types.h;fp=include%2Fcounter%2Fcounter-types.h;h=5ae01849621408dfae1ee376e403b6e48d6f5bb0;hb=a101fa100885861be33fab3966db2c5136815724;hp=0000000000000000000000000000000000000000;hpb=e699ee6c837345eb408d600178cc6054ca131164;p=lttng-modules.git diff --git a/include/counter/counter-types.h b/include/counter/counter-types.h new file mode 100644 index 00000000..5ae01849 --- /dev/null +++ b/include/counter/counter-types.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * + * counter/counter-types.h + * + * LTTng Counters Types + * + * Copyright (C) 2020 Mathieu Desnoyers + */ + +#ifndef _LTTNG_COUNTER_TYPES_H +#define _LTTNG_COUNTER_TYPES_H + +#include +#include +#include + +struct lib_counter_dimension { + /* + * Max. number of indexable elements. + */ + size_t max_nr_elem; + /* + * The stride for a dimension is the multiplication factor which + * should be applied to its index to take into account other + * dimensions nested inside. + */ + size_t stride; +}; + +struct lib_counter_layout { + void *counters; + unsigned long *underflow_bitmap; + unsigned long *overflow_bitmap; +}; + +enum lib_counter_arithmetic { + LIB_COUNTER_ARITHMETIC_MODULAR, + LIB_COUNTER_ARITHMETIC_SATURATE, +}; + +struct lib_counter { + size_t nr_dimensions; + int64_t allocated_elem; + struct lib_counter_dimension *dimensions; + enum lib_counter_arithmetic arithmetic; + union { + struct { + int32_t max, min; + } limits_32_bit; + struct { + int64_t max, min; + } limits_64_bit; + } saturation; + union { + int8_t s8; + int16_t s16; + int32_t s32; + int64_t s64; + } global_sum_step; /* 0 if unused */ + struct lib_counter_config config; + + struct lib_counter_layout global_counters; + struct lib_counter_layout __percpu *percpu_counters; +}; + +#endif /* _LTTNG_COUNTER_TYPES_H */