Annotation of sys/dev/raidframe/rf_hist.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: rf_hist.h,v 1.3 2002/12/16 07:01:04 tdeval Exp $ */
! 2: /* $NetBSD: rf_hist.h,v 1.3 1999/02/05 00:06:12 oster Exp $ */
! 3:
! 4: /*
! 5: * rf_hist.h
! 6: *
! 7: * Histgram operations for RAIDframe stats.
! 8: */
! 9: /*
! 10: * Copyright (c) 1995 Carnegie-Mellon University.
! 11: * All rights reserved.
! 12: *
! 13: * Author: Jim Zelenka
! 14: *
! 15: * Permission to use, copy, modify and distribute this software and
! 16: * its documentation is hereby granted, provided that both the copyright
! 17: * notice and this permission notice appear in all copies of the
! 18: * software, derivative works or modified versions, and any portions
! 19: * thereof, and that both notices appear in supporting documentation.
! 20: *
! 21: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
! 22: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
! 23: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
! 24: *
! 25: * Carnegie Mellon requests users of this software to return to
! 26: *
! 27: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
! 28: * School of Computer Science
! 29: * Carnegie Mellon University
! 30: * Pittsburgh PA 15213-3890
! 31: *
! 32: * any improvements or extensions that they make and grant Carnegie the
! 33: * rights to redistribute these changes.
! 34: */
! 35:
! 36: #ifndef _RF__RF_HIST_H_
! 37: #define _RF__RF_HIST_H_
! 38:
! 39: #include "rf_types.h"
! 40:
! 41: #define RF_HIST_RESOLUTION 5
! 42: #define RF_HIST_MIN_VAL 0
! 43: #define RF_HIST_MAX_VAL 1000
! 44: #define RF_HIST_RANGE (RF_HIST_MAX_VAL - RF_HIST_MIN_VAL)
! 45: #define RF_HIST_NUM_BUCKETS (RF_HIST_RANGE / RF_HIST_RESOLUTION + 1)
! 46:
! 47: typedef RF_uint32 RF_Hist_t;
! 48:
! 49: #define RF_HIST_ADD(_hist_,_val_) do { \
! 50: RF_Hist_t val; \
! 51: val = ((RF_Hist_t)(_val_)) / 1000; \
! 52: if (val >= RF_HIST_MAX_VAL) \
! 53: _hist_[RF_HIST_NUM_BUCKETS-1]++; \
! 54: else \
! 55: _hist_[(val - RF_HIST_MIN_VAL) / RF_HIST_RESOLUTION]++; \
! 56: } while (0)
! 57:
! 58: #endif /* !_RF__RF_HIST_H_ */
CVSweb