* Dump IPSEC statistics structure. */
| 226 | * Dump IPSEC statistics structure. |
| 227 | */ |
| 228 | static void |
| 229 | ipsec_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 | |
| 263 | static void |
| 264 | print_ahstats(const struct ahstat *ahstat) |
nothing calls this directly
no test coverage detected