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(const struct lib_counter_config
*config
,
18 struct lib_counter
*counter
,
19 const size_t *dimension_indexes
)
21 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
23 for (i
= 0; i
< nr_dimensions
; i
++) {
24 if (caa_unlikely(dimension_indexes
[i
] >= counter
->dimensions
[i
].max_nr_elem
))
31 static inline size_t lttng_counter_get_index(const struct lib_counter_config
*config
,
32 struct lib_counter
*counter
,
33 const size_t *dimension_indexes
)
35 size_t nr_dimensions
= counter
->nr_dimensions
, i
;
38 for (i
= 0; i
< nr_dimensions
; i
++) {
39 struct lib_counter_dimension
*dimension
= &counter
->dimensions
[i
];
40 const size_t *dimension_index
= &dimension_indexes
[i
];
42 index
+= *dimension_index
* dimension
->stride
;
47 #endif /* _LTTNG_COUNTER_INTERNAL_H */
This page took 0.030003 seconds and 4 git commands to generate.