throughput.c (102500) | throughput.c (212829) |
---|---|
1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/usr.sbin/ppp/throughput.c 102500 2002-08-27 20:11:58Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/throughput.c 212829 2010-09-18 22:26:50Z n_hibma $ |
27 */ 28 29#include <sys/types.h> 30 31#include <stdarg.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <string.h> --- 161 unchanged lines hidden (view full) --- 196throughput_start(struct pppThroughput *t, const char *name, int rolling) 197{ 198 int i; 199 timer_Stop(&t->Timer); 200 201 for (i = 0; i < t->SamplePeriod; i++) 202 t->in.SampleOctets[i] = t->out.SampleOctets[i] = 0; 203 t->nSample = 0; | 27 */ 28 29#include <sys/types.h> 30 31#include <stdarg.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <string.h> --- 161 unchanged lines hidden (view full) --- 196throughput_start(struct pppThroughput *t, const char *name, int rolling) 197{ 198 int i; 199 timer_Stop(&t->Timer); 200 201 for (i = 0; i < t->SamplePeriod; i++) 202 t->in.SampleOctets[i] = t->out.SampleOctets[i] = 0; 203 t->nSample = 0; |
204 t->OctetsIn = t->OctetsOut = 0; | 204 t->OctetsIn = t->OctetsOut = t->PacketsIn = t->PacketsOut = 0; |
205 t->in.OctetsPerSecond = t->out.OctetsPerSecond = t->BestOctetsPerSecond = 0; 206 time(&t->BestOctetsPerSecondTime); 207 t->downtime = 0; 208 time(&t->uptime); 209 throughput_restart(t, name, rolling); 210} 211 212void --- 50 unchanged lines hidden (view full) --- 263 264 if (clear_type & THROUGHPUT_OVERALL) { 265 int divisor; 266 267 if ((divisor = throughput_uptime(t)) == 0) 268 divisor = 1; 269 prompt_Printf(prompt, "overall cleared (was %6qu bytes/sec)\n", 270 (t->OctetsIn + t->OctetsOut) / divisor); | 205 t->in.OctetsPerSecond = t->out.OctetsPerSecond = t->BestOctetsPerSecond = 0; 206 time(&t->BestOctetsPerSecondTime); 207 t->downtime = 0; 208 time(&t->uptime); 209 throughput_restart(t, name, rolling); 210} 211 212void --- 50 unchanged lines hidden (view full) --- 263 264 if (clear_type & THROUGHPUT_OVERALL) { 265 int divisor; 266 267 if ((divisor = throughput_uptime(t)) == 0) 268 divisor = 1; 269 prompt_Printf(prompt, "overall cleared (was %6qu bytes/sec)\n", 270 (t->OctetsIn + t->OctetsOut) / divisor); |
271 t->OctetsIn = t->OctetsOut = 0; | 271 t->OctetsIn = t->OctetsOut = t->PacketsIn = t->PacketsOut = 0; |
272 t->downtime = 0; 273 time(&t->uptime); 274 } 275 276 if (clear_type & THROUGHPUT_CURRENT) { 277 prompt_Printf(prompt, "current cleared (was %6qu bytes/sec in," 278 " %6qu bytes/sec out)\n", 279 t->in.OctetsPerSecond, t->out.OctetsPerSecond); --- 23 unchanged lines hidden --- | 272 t->downtime = 0; 273 time(&t->uptime); 274 } 275 276 if (clear_type & THROUGHPUT_CURRENT) { 277 prompt_Printf(prompt, "current cleared (was %6qu bytes/sec in," 278 " %6qu bytes/sec out)\n", 279 t->in.OctetsPerSecond, t->out.OctetsPerSecond); --- 23 unchanged lines hidden --- |