2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * LTTng Counters Internal Header
9 #ifndef _LTTNG_COUNTER_INTERNAL_H
10 #define _LTTNG_COUNTER_INTERNAL_H
15 #include <lttng/ust-config.h>
16 #include <urcu/compiler.h>
17 #include "counter-types.h"
19 static inline int lttng_counter_validate_indexes(
20 const struct lib_counter_config
*config
__attribute__((unused
)),
21 struct lib_counter
*counter
,
22 const size_t *dimension_indexes
)
24 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
26 for (i
= 0; i
< nr_dimensions
; i
++) {
27 if (caa_unlikely(dimension_indexes
[i
] >= counter
->dimensions
[i
].max_nr_elem
))
34 static inline size_t lttng_counter_get_index(
35 const struct lib_counter_config
*config
__attribute__((unused
)),
36 struct lib_counter
*counter
,
37 const size_t *dimension_indexes
)
39 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
42 for (i
= 0; i
< nr_dimensions
; i
++) {
43 struct lib_counter_dimension
*dimension
= &counter
->dimensions
[i
];
44 const size_t *dimension_index
= &dimension_indexes
[i
];
46 index
+= *dimension_index
* dimension
->stride
;
51 #endif /* _LTTNG_COUNTER_INTERNAL_H */
This page took 0.034386 seconds and 4 git commands to generate.