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
13 #include <lttng/ust-config.h>
14 #include <urcu/compiler.h>
15 #include "counter-types.h"
17 static inline int lttng_counter_validate_indexes(
18 const struct lib_counter_config
*config
__attribute__((unused
)),
19 struct lib_counter
*counter
,
20 const size_t *dimension_indexes
)
22 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
24 for (i
= 0; i
< nr_dimensions
; i
++) {
25 if (caa_unlikely(dimension_indexes
[i
] >= counter
->dimensions
[i
].max_nr_elem
))
32 static inline size_t lttng_counter_get_index(
33 const struct lib_counter_config
*config
__attribute__((unused
)),
34 struct lib_counter
*counter
,
35 const size_t *dimension_indexes
)
37 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
40 for (i
= 0; i
< nr_dimensions
; i
++) {
41 struct lib_counter_dimension
*dimension
= &counter
->dimensions
[i
];
42 const size_t *dimension_index
= &dimension_indexes
[i
];
44 index
+= *dimension_index
* dimension
->stride
;
49 #endif /* _LTTNG_COUNTER_INTERNAL_H */
This page took 0.030319 seconds and 4 git commands to generate.