MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ipsec_hist_new

Function ipsec_hist_new

tools/netstat/ipsec.c:228–261  ·  view source on GitHub ↗

* Dump IPSEC statistics structure. */

Source from the content-addressed store, hash-verified

226 * Dump IPSEC statistics structure.
227 */
228static void
229ipsec_hist_new(const uint64_t *hist, size_t histmax,
230 const struct val2str *name, const char *title, const char *cname)
231{
232 int first;
233 size_t proto;
234 const struct val2str *p;
235
236 first = 1;
237 for (proto = 0; proto < histmax; proto++) {
238 if (hist[proto] <= 0)
239 continue;
240 if (first) {
241 xo_open_list(cname);
242 xo_emit("\t{T:/%s histogram}:\n", title);
243 first = 0;
244 }
245 xo_open_instance(cname);
246 for (p = name; p && p->str; p++) {
247 if (p->val == (int)proto)
248 break;
249 }
250 if (p && p->str) {
251 xo_emit("\t\t{k:name}: {:count/%ju}\n", p->str,
252 (uintmax_t)hist[proto]);
253 } else {
254 xo_emit("\t\t#{k:name/%lu}: {:count/%ju}\n",
255 (unsigned long)proto, (uintmax_t)hist[proto]);
256 }
257 xo_close_instance(cname);
258 }
259 if (!first)
260 xo_close_list(cname);
261}
262
263static void
264print_ahstats(const struct ahstat *ahstat)

Callers

nothing calls this directly

Calls 5

xo_open_listFunction · 0.85
xo_emitFunction · 0.85
xo_open_instanceFunction · 0.85
xo_close_instanceFunction · 0.85
xo_close_listFunction · 0.85

Tested by

no test coverage detected