/* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ #ifndef lint static char sccsid[] = "@(#)networkdelta.c 2.1 (Berkeley) 12/10/85"; #endif not lint #include "globals.h" #include extern int machup; /* * `networkdelta' selects the largest set of deltas that fall within the * interval RANGE, and uses them to compute the network average delta */ long networkdelta() { int i, j, maxind, minind; int ext; int tempind; long tempdata; long x[NHOSTS]; long average; for (i=0; i i+1) j--; if ((x[j]-x[i] <= RANGE) && (j-i >= maxind-minind)) { minind=i; maxind=j; } i++; if(i = j) j++; } } while (j < machup); if ((x[machup-1] - x[i] <= RANGE) && (machup-i-1 >= maxind-minind)) { minind=i; maxind=machup-1; } /****/ compute: ext = maxind - minind + 1; average = 0; for (i=minind; i<=maxind; i++) average += x[i]; average /= ext; return(average); }