summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/throughput.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-28 22:44:54 +0000
committerbrian <brian@FreeBSD.org>2000-08-28 22:44:54 +0000
commitcb1cdc90fa757e0475f2fa90070cd79541400475 (patch)
tree1920267811fb05c150fd456a8121562e12dc48c9 /usr.sbin/ppp/throughput.c
parentf47bf1f4e6a3f541e2923ccc99ff4e21f9b60094 (diff)
downloadFreeBSD-src-cb1cdc90fa757e0475f2fa90070cd79541400475.zip
FreeBSD-src-cb1cdc90fa757e0475f2fa90070cd79541400475.tar.gz
Support radius accounting, and add a packet count to throughput
statistics as a side effect. Submitted by: Marcin Cieslak <saper@system.pl> with some tweaks to RAD_ACCT_SESSION_ID and RAD_ACCT_MULTI_SESSION_ID generation by me.
Diffstat (limited to 'usr.sbin/ppp/throughput.c')
-rw-r--r--usr.sbin/ppp/throughput.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/ppp/throughput.c b/usr.sbin/ppp/throughput.c
index 798878f..51c1a54 100644
--- a/usr.sbin/ppp/throughput.c
+++ b/usr.sbin/ppp/throughput.c
@@ -44,7 +44,7 @@
void
throughput_init(struct pppThroughput *t, int period)
{
- t->OctetsIn = t->OctetsOut = 0;
+ t->OctetsIn = t->OctetsOut = t->PacketsIn = t->PacketsOut = 0;
t->SamplePeriod = period;
t->in.SampleOctets = (long long *)
calloc(period, sizeof *t->in.SampleOctets);
@@ -111,6 +111,8 @@ throughput_disp(struct pppThroughput *t, struct prompt *prompt)
divisor = secs_up ? secs_up : 1;
prompt_Printf(prompt, "%llu octets in, %llu octets out\n",
t->OctetsIn, t->OctetsOut);
+ prompt_Printf(prompt, "%llu packets in, %llu packets out\n",
+ t->PacketsIn, t->PacketsOut);
if (t->rolling) {
prompt_Printf(prompt, " overall %6qu bytes/sec\n",
(t->OctetsIn + t->OctetsOut) / divisor);
@@ -137,8 +139,10 @@ throughput_log(struct pppThroughput *t, int level, const char *title)
if (title == NULL)
title = "";
log_Printf(level, "%s%sConnect time: %d secs: %llu octets in, %llu octets"
- " out\n", title, *title ? ": " : "", secs_up, t->OctetsIn,
- t->OctetsOut);
+ " out\n", title, *title ? ": " : "", secs_up, t->OctetsIn,
+ t->OctetsOut);
+ log_Printf(level, "%s%s: %llu packets in, %llu packets out\n",
+ title, *title ? ": " : "", t->PacketsIn, t->PacketsOut);
if (secs_up == 0)
secs_up = 1;
if (t->rolling)
@@ -235,12 +239,14 @@ void
throughput_addin(struct pppThroughput *t, long long n)
{
t->OctetsIn += n;
+ t->PacketsIn++;
}
void
throughput_addout(struct pppThroughput *t, long long n)
{
t->OctetsOut += n;
+ t->PacketsOut++;
}
void
OpenPOWER on IntegriCloud