Lines Matching +full:avg +full:- +full:samples
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
20 * 02110-1301, USA.
45 * struct uwb_dev - a UWB Device
50 * @mac_addr: the EUI-48 address of this device.
109 * struct uwb_mas_bm - a bitmap of all MAS in a superframe
120 * uwb_rsv_state - UWB Reservation state.
122 * NONE - reservation is not active (no DRP IE being transmitted).
126 * INITIATED - owner has sent an initial DRP request.
127 * PENDING - target responded with pending Reason Code.
128 * MODIFIED - reservation manager is modifying an established
130 * ESTABLISHED - the reservation has been successfully negotiated.
134 * DENIED - request is denied.
135 * ACCEPTED - request is accepted.
136 * PENDING - PAL has yet to make a decision to whether to accept or
170 * struct uwb_rsv_target - the target of a reservation.
198 * struct uwb_rsv - a DRP reservation
273 bitmap_copy_le(dst, mas->bm, UWB_NUM_MAS); in uwb_mas_bm_copy_le()
277 * struct uwb_drp_avail - a radio controller's view of MAS usage
295 * rc->rsvs_mutex should be held before accessing this data structure.
297 * [ECMA-368] section 17.4.3.
350 * because rc->cmd() can sleep.
366 * amount used is given by sizeof(*ies) plus ies->wIELength
425 * struct uwb_pal - a UWB PAL
431 * A channel of -1 means the channel has been stopped.
435 * the radio; -1 if the PAL wishes to use the radio but
484 get_device(&uwb_dev->dev); in uwb_dev_get()
488 put_device(&uwb_dev->dev); in uwb_dev_put()
539 return __uwb_addr_print(buf, buf_size, addr->data, 0); in uwb_dev_addr_print()
546 return __uwb_addr_print(buf, buf_size, addr->data, 1); in uwb_mac_addr_print()
604 * uwb_rsv_is_owner - is the owner of this reservation the RC?
609 return rsv->owner == &rsv->rc->uwb_dev; in uwb_rsv_is_owner()
613 * enum uwb_notifs - UWB events that can be passed to any listeners
661 * payload. This allows device-specific event size tables to be
666 * @offset: if != 0, at offset @offset-1 starts a field with a length
687 /* -- Misc */
703 edc->timestart = jiffies; in edc_init()
720 if (now - err_hist->timestart > timeframe) { in edc_inc()
721 err_hist->errorcount = 1; in edc_inc()
722 err_hist->timestart = now; in edc_inc()
723 } else if (++err_hist->errorcount > max_err) { in edc_inc()
724 err_hist->errorcount = 0; in edc_inc()
725 err_hist->timestart = now; in edc_inc()
746 * (@sigma) and a # of samples. When @samples gets to 255, we compute
747 * the average (@sigma / @samples), place it in @sigma and reset
748 * @samples to 1 (so we use it as the first sample).
755 * schema. Only _add_samples() modifies the values--as long as you
758 * resetting the values we just set @samples to 0 and that makes the
768 atomic_t samples; member
774 atomic_set(&stats->samples, 0); in stats_init()
783 unsigned samples = atomic_read(&stats->samples); in stats_add_sample() local
784 if (samples == 0) { /* it was zero before, so we initialize */ in stats_add_sample()
786 max = -128; in stats_add_sample()
789 min = stats->min; in stats_add_sample()
790 max = stats->max; in stats_add_sample()
791 sigma = stats->sigma; in stats_add_sample()
800 stats->min = min; /* commit */ in stats_add_sample()
801 stats->max = max; in stats_add_sample()
802 stats->sigma = sigma; in stats_add_sample()
803 if (atomic_add_return(1, &stats->samples) > 255) { in stats_add_sample()
805 stats->sigma = sigma / 256; in stats_add_sample()
806 atomic_set(&stats->samples, 1); in stats_add_sample()
812 int min, max, avg; in stats_show() local
813 int samples = atomic_read(&stats->samples); in stats_show() local
814 if (samples == 0) in stats_show()
815 min = max = avg = 0; in stats_show()
817 min = stats->min; in stats_show()
818 max = stats->max; in stats_show()
819 avg = stats->sigma / samples; in stats_show()
821 return scnprintf(buf, PAGE_SIZE, "%d %d %d\n", min, max, avg); in stats_show()