Deleted Added
sdiff udiff text old ( 126354 ) new ( 126355 )
full compact
1/* $OpenBSD: pfctl_qstats.c,v 1.24 2003/07/31 09:46:08 kjc Exp $ */
2
3/*
4 * Copyright (c) Henning Brauer <henning@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.

--- 22 unchanged lines hidden (view full) ---

31#include <string.h>
32#include <unistd.h>
33
34#include <altq/altq.h>
35#include <altq/altq_cbq.h>
36#include <altq/altq_priq.h>
37#include <altq/altq_hfsc.h>
38
39#include "pfctl.h"
40#include "pfctl_parser.h"
41
42union class_stats {
43 class_stats_t cbq_stats;
44 struct priq_classstats priq_stats;
45 struct hfsc_classstats hfsc_stats;
46};

--- 33 unchanged lines hidden (view full) ---

80
81void update_avg(struct pf_altq_node *);
82
83int
84pfctl_show_altq(int dev, int opts, int verbose2)
85{
86 struct pf_altq_node *root = NULL, *node;
87
88 if (pfctl_update_qstats(dev, &root))
89 return (-1);
90
91 for (node = root; node != NULL; node = node->next)
92 pfctl_print_altq_node(dev, node, 0, opts);
93
94 while (verbose2) {
95 printf("\n");

--- 174 unchanged lines hidden (view full) ---

270 print_hfscstats(a->qstats);
271 break;
272 }
273}
274
275void
276print_cbqstats(struct queue_stats cur)
277{
278 printf(" [ pkts: %10llu bytes: %10llu "
279 "dropped pkts: %6llu bytes: %6llu ]\n",
280 cur.data.cbq_stats.xmit_cnt.packets,
281 cur.data.cbq_stats.xmit_cnt.bytes,
282 cur.data.cbq_stats.drop_cnt.packets,
283 cur.data.cbq_stats.drop_cnt.bytes);
284 printf(" [ qlength: %3d/%3d borrows: %6u suspends: %6u ]\n",
285 cur.data.cbq_stats.qcnt, cur.data.cbq_stats.qmax,
286 cur.data.cbq_stats.borrows, cur.data.cbq_stats.delays);
287
288 if (cur.avgn < 2)
289 return;
290
291 printf(" [ measured: %7.1f packets/s, %s/s ]\n",
292 cur.avg_packets / STAT_INTERVAL,
293 rate2str((8 * cur.avg_bytes) / STAT_INTERVAL));
294}
295
296void
297print_priqstats(struct queue_stats cur)
298{
299 printf(" [ pkts: %10llu bytes: %10llu "
300 "dropped pkts: %6llu bytes: %6llu ]\n",
301 cur.data.priq_stats.xmitcnt.packets,
302 cur.data.priq_stats.xmitcnt.bytes,
303 cur.data.priq_stats.dropcnt.packets,
304 cur.data.priq_stats.dropcnt.bytes);
305 printf(" [ qlength: %3d/%3d ]\n",
306 cur.data.priq_stats.qlength, cur.data.priq_stats.qlimit);
307
308 if (cur.avgn < 2)
309 return;
310
311 printf(" [ measured: %7.1f packets/s, %s/s ]\n",
312 cur.avg_packets / STAT_INTERVAL,
313 rate2str((8 * cur.avg_bytes) / STAT_INTERVAL));
314}
315
316void
317print_hfscstats(struct queue_stats cur)
318{
319 printf(" [ pkts: %10llu bytes: %10llu "
320 "dropped pkts: %6llu bytes: %6llu ]\n",
321 cur.data.hfsc_stats.xmit_cnt.packets,
322 cur.data.hfsc_stats.xmit_cnt.bytes,
323 cur.data.hfsc_stats.drop_cnt.packets,
324 cur.data.hfsc_stats.drop_cnt.bytes);
325 printf(" [ qlength: %3d/%3d ]\n",
326 cur.data.hfsc_stats.qlength, cur.data.hfsc_stats.qlimit);
327
328 if (cur.avgn < 2)

--- 73 unchanged lines hidden ---