lib: remove librte_ prefix from directory names
[dpdk.git] / lib / bitratestats / rte_bitrate.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4
5 #ifndef _RTE_BITRATE_H_
6 #define _RTE_BITRATE_H_
7
8 #include <stdint.h>
9
10 #include <rte_compat.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /**
17  *  Bitrate statistics data structure.
18  *  This data structure is intentionally opaque.
19  */
20 struct rte_stats_bitrates;
21
22
23 /**
24  * Allocate a bitrate statistics structure
25  *
26  * @return
27  *   - Pointer to structure on success
28  *   - NULL on error (zmalloc failure)
29  */
30 struct rte_stats_bitrates *rte_stats_bitrate_create(void);
31
32 /**
33  * Free bitrate statistics structure
34  *
35  * @param bitrate_data
36  *   Pointer allocated by rte_stats_bitrate_create()
37  */
38 __rte_experimental
39 void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data);
40
41 /**
42  * Register bitrate statistics with the metric library.
43  *
44  * @param bitrate_data
45  *   Pointer allocated by rte_stats_bitrate_create()
46  *
47  * @return
48  *   Zero on success
49  *   Negative on error
50  */
51 int rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data);
52
53
54 /**
55  * Calculate statistics for current time window. The period with which
56  * this function is called should be the intended sampling window width.
57  *
58  * @param bitrate_data
59  *   Bitrate statistics data pointer
60  *
61  * @param port_id
62  *   Port id to calculate statistics for
63  *
64  * @return
65  *  - Zero on success
66  *  - Negative value on error
67  */
68 int rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
69                            uint16_t port_id);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif /* _RTE_BITRATE_H_ */