1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2013. ALL RIGHTS RESERVED.
* Copyright (C) Huawei Technologies Co., Ltd. 2021. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/*
* Serialization options
*/
;
typedef struct ucs_stats_server *ucs_stats_server_h; /* Handle to server */
typedef struct ucs_stats_client *ucs_stats_client_h; /* Handle to client */
typedef enum ucs_stats_children_sel ucs_stats_children_sel_t;
/* Statistics class */
;
/*
* ucs_stats_node is used to hold the counters, their classes and the
* relationship between them.
* ucs_stats_filter_node is a data structure used to filter the counters
* on the report.
* There are 3 types of filtering: Full, Aggregate, and summary
* Following is an example of the data structures in aggregate mode:
*
* ucs_stats_node ucs_stats_filter_node
* -------------- ---------------------
*
* +-----+ +-----+
* | A-1 |............................> | A-1 |
* +-----+ +-----+
* A A A A
* | | | |
* | | +----------+ |
* | | | |
* +--+ +--+ +--+--+................. |
* | | | B-1 | : |
* | | +-----+ : |
* | +-----+....|..A................. : |
* | | B-2 | | | : : |
* | +-----+ <--+ | V V |
* +-----+......|..........|.............> +-----+
* | B-3 | || +---------------| B* |
* +-----+ <----+ +-----+
* cntr1 cntr1*
* cntr2 cntr2*
* cntr3 cntr3*
*
* unfiltered statistics report:
*
* A-1:
* B-1:
* cntr1: 11111
* cntr2: 22222
* cntr3: 33333
* B-2:
* cntr1: 11111
* cntr2: 22222
* cntr3: 33333
* B-3:
* cntr1: 11111
* cntr2: 22222
* cntr3: 33333
*
* filtered statistics report:
*
* A-1:
* B*:
* cntr1: 33333
* cntr2: 66666
* cntr3: 99999
*
*/
/* In-memory statistics node */
;
;
/**
* Initialize statistics node.
*
* @param node Node to initialize.
* @param cls Node class.
* @param name Node name format string.
* @param ap Name formatting arguments.
*/
ucs_status_t ;
/**
* Serialize statistics.
*
* @param stream Destination
* @param root Statistics node root.
* @param options Serialization options.
*/
ucs_status_t ;
/**
* De-serialize statistics.
*
* @param stream Source data.
* @param p_roo Filled with tatistics node root.
*
* @return UCS_ERR_NO_ELEM if hit EOF.
*/
ucs_status_t ;
/**
* Release stats returned by ucs_stats_deserialize().
* @param root Stats to release.
*/
void ;
/**
* Initialize statistics client.
*
* @param server_addr Address of server machine.
* @param port Port number on server.
* @param p_client Filled with handle to the client.
*/
ucs_status_t ;
/**
* Destroy statistics client.
*/
void ;
/**
* Send statistics.
*
* @param client Client handle.
* @param root Statistics tree root.
* @param timestamp Current statistics timestamp, identifies every "snapshot".
*/
ucs_status_t ;
/**
* Start a thread running a server which receives statistics.
*
* @param port Port number to listen on. 0 - random available port.
* @param verbose Verbose level.
* @param p_server Filled with handle to the server.
*/
ucs_status_t ;
/**
* Stop statistics server.
* @param server Handle to statistics server.
*/
void ;
/**
* Get port number used by the server, useful if we started it on a random port.
*
* @param server Handle to statistics server.
*
* @return Port number.
*/
int ;
/**
* Get current statistics gathered by the server. The data is valid until the next
* call to any of the following functions:
* - ucs_stats_server_purge_stats
* - ucs_stats_server_cleanup
* - ucs_stats_server_get_stats
*
* @param server Handle to statistics server.
* @return A list of stat trees for all entities gathered by the server.
*/
ucs_list_link_t *;
/**
* Clean up existing statistics.
*/
void ;
/**
* @return Number of packets received by the server.
*/
unsigned long ;
/* LIBSTATS_H_ */