Deleted Added
sdiff udiff text old ( 126354 ) new ( 126355 )
full compact
1/* $FreeBSD: head/contrib/pf/pfctl/pfctl_qstats.c 126355 2004-02-28 17:32:53Z mlaier $ */
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
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
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{
289 printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
290 "dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
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{
310 printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
311 "dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
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{
330 printf(" [ pkts: %10"PRIu64" bytes: %10"PRIu64" "
331 "dropped pkts: %6"PRIu64" bytes: %6"PRIu64" ]\n",
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 ---