Lines Matching +full:average +full:- +full:on
2 * ntp_monitor - monitor ntpd statistics
22 * Record statistics based on source address, mode and version. The
27 * Each entry is doubly linked into two lists, a hash table and a most-
28 * recently-used (MRU) list. When a packet arrives it is looked up in
68 * List of free structures structures, and counters of in-use and total
82 * headway is less than the minimum, as well as if the average headway
87 u_char ntp_minpoll = NTP_MINPOLL; /* minimum average log2 seconds */
108 * init_mon - initialize monitoring global data
123 * remove_from_hash - removes an entry from the address hash table and
134 mru_entries--; in remove_from_hash()
135 hash = MON_HASH(&mon->rmtadr); in remove_from_hash()
153 * mon_reclaim_entry - Remove an entry from the MRU list and from the
154 * hash array, then zero-initialize it. Indirectly
175 * mon_getmoremem - get more memory and put it on the free list
190 for (chunk += entries; entries; entries--) in mon_getmoremem()
191 mon_free_entry(--chunk); in mon_getmoremem()
199 * mon_start - start up the monitoring software
218 * Select the MRU hash table size to limit the average count in mon_start()
236 * mon_stop - stop the monitoring software
255 * Move everything on the MRU list to the free list quickly, in mon_stop()
271 * mon_clearinterface -- remove mru entries referring to a local address
283 if (mon->lcladr == lcladr) { in mon_clearinterface()
288 /* put on free list */ in mon_clearinterface()
296 * ntp_monitor - record stats about this packet
306 * such responses. ntpdc -c reslist lets you see whether RES_LIMITED
328 int limit; /* average threshold */ in ntp_monitor()
335 pkt = &rbufp->recv_pkt; in ntp_monitor()
336 hash = MON_HASH(&rbufp->recv_srcadr); in ntp_monitor()
337 mode = PKT_MODE(pkt->li_vn_mode); in ntp_monitor()
338 version = PKT_VERSION(pkt->li_vn_mode); in ntp_monitor()
346 for (; mon != NULL; mon = mon->hash_next) { in ntp_monitor()
347 if (SOCK_EQ(&mon->rmtadr, &rbufp->recv_srcadr)) { in ntp_monitor()
352 interval_fp = rbufp->recv_time; in ntp_monitor()
353 L_SUB(&interval_fp, &mon->last); in ntp_monitor()
354 /* add one-half second to round up */ in ntp_monitor()
357 mon->last = rbufp->recv_time; in ntp_monitor()
358 NSRCPORT(&mon->rmtadr) = NSRCPORT(&rbufp->recv_srcadr); in ntp_monitor()
359 mon->count++; in ntp_monitor()
361 mon->vn_mode = VN_MODE(version, mode); in ntp_monitor()
372 mon->leak -= interval; in ntp_monitor()
373 mon->leak = max(0, mon->leak); in ntp_monitor()
375 leak = mon->leak + head; in ntp_monitor()
382 * If the minimum and average thresholds are not in ntp_monitor()
385 * that we give a 1-s grace for the minimum threshold in ntp_monitor()
386 * and a 2-s grace for the headway increment. If one or in ntp_monitor()
388 * less than the average threshold, set the counter to in ntp_monitor()
389 * the average threshold plus the increment and leave in ntp_monitor()
392 * This rate-limits the KoDs to no more often than the in ntp_monitor()
393 * average headway. in ntp_monitor()
396 mon->leak = leak - 2; in ntp_monitor()
398 } else if (mon->leak < limit) { in ntp_monitor()
399 mon->leak = limit + head; in ntp_monitor()
403 mon->flags = restrict_mask; in ntp_monitor()
405 return mon->flags; in ntp_monitor()
415 * - mru_mindepth ("mru mindepth") is a floor beneath which in ntp_monitor()
418 * limit on the total number of entries. in ntp_monitor()
419 * - mru_maxage ("mru maxage") is a ceiling on the age in in ntp_monitor()
424 * - mru_maxdepth ("mru maxdepth") is a hard limit on the in ntp_monitor()
426 * - "mru maxmem" sets mru_maxdepth to the number of entries in ntp_monitor()
429 * - mru_initalloc ("mru initalloc" sets the count of the in ntp_monitor()
431 * - "mru initmem" sets mru_initalloc in units of kilobytes. in ntp_monitor()
433 * - mru_incalloc ("mru incalloc" sets the number of entries to in ntp_monitor()
434 * allocate on-demand each time the free list is empty. in ntp_monitor()
435 * - "mru incmem" sets mru_incalloc in units of kilobytes. in ntp_monitor()
449 interval_fp = rbufp->recv_time; in ntp_monitor()
450 L_SUB(&interval_fp, &oldest->last); in ntp_monitor()
451 /* add one-half second to round up */ in ntp_monitor()
455 /* note -1 is legal for mru_maxage (disables) */ in ntp_monitor()
481 mon->last = rbufp->recv_time; in ntp_monitor()
482 mon->first = mon->last; in ntp_monitor()
483 mon->count = 1; in ntp_monitor()
484 mon->flags = ~(RES_LIMITED | RES_KOD) & flags; in ntp_monitor()
485 mon->leak = 0; in ntp_monitor()
486 memcpy(&mon->rmtadr, &rbufp->recv_srcadr, sizeof(mon->rmtadr)); in ntp_monitor()
487 mon->vn_mode = VN_MODE(version, mode); in ntp_monitor()
488 mon->lcladr = rbufp->dstadr; in ntp_monitor()
489 mon->cast_flags = (u_char)(((rbufp->dstadr->flags & in ntp_monitor()
490 INT_MCASTOPEN) && rbufp->fd == mon->lcladr->fd) ? MDF_MCAST in ntp_monitor()
491 : rbufp->fd == mon->lcladr->bfd ? MDF_BCAST : MDF_UCAST); in ntp_monitor()
494 * Drop him into front of the hash table. Also put him on top of in ntp_monitor()
500 return mon->flags; in ntp_monitor()