Deleted Added
full compact
pfctl_qstats.c (126354) pfctl_qstats.c (126355)
1/* $FreeBSD: head/contrib/pf/pfctl/pfctl_qstats.c 126355 2004-02-28 17:32:53Z mlaier $ */
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
2/* $OpenBSD: pfctl_qstats.c,v 1.24 2003/07/31 09:46:08 kjc Exp $ */
3
4/*
5 * Copyright (c) Henning Brauer <henning@openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.

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

32#include <string.h>
33#include <unistd.h>
34
35#include <altq/altq.h>
36#include <altq/altq_cbq.h>
37#include <altq/altq_priq.h>
38#include <altq/altq_hfsc.h>
39
40#if defined(__FreeBSD__)
41#include <inttypes.h>
42#else
43#define PRIu64 "llu"
44#endif
45
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
46#include "pfctl.h"
47#include "pfctl_parser.h"
48
49union class_stats {
50 class_stats_t cbq_stats;
51 struct priq_classstats priq_stats;
52 struct hfsc_classstats hfsc_stats;
53};

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

87
88void update_avg(struct pf_altq_node *);
89
90int
91pfctl_show_altq(int dev, int opts, int verbose2)
92{
93 struct pf_altq_node *root = NULL, *node;
94
95#if defined(__FreeBSD__)
96 if (!altqsupport)
97 return (-1);
98#endif
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{
99 if (pfctl_update_qstats(dev, &root))
100 return (-1);
101
102 for (node = root; node != NULL; node = node->next)
103 pfctl_print_altq_node(dev, node, 0, opts);
104
105 while (verbose2) {
106 printf("\n");

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

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

--- 73 unchanged lines hidden ---