1 /* $NetBSD: rf_hist.h,v 1.3 1999/02/05 00:06:12 oster Exp $ */
5 * Histgram operations for RAIDframe stats
8 * Copyright (c) 1995 Carnegie-Mellon University.
13 * Permission to use, copy, modify and distribute this software and
14 * its documentation is hereby granted, provided that both the copyright
15 * notice and this permission notice appear in all copies of the
16 * software, derivative works or modified versions, and any portions
17 * thereof, and that both notices appear in supporting documentation.
19 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
20 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
21 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
23 * Carnegie Mellon requests users of this software to return to
25 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
26 * School of Computer Science
27 * Carnegie Mellon University
28 * Pittsburgh PA 15213-3890
30 * any improvements or extensions that they make and grant Carnegie the
31 * rights to redistribute these changes.
34 #ifndef _RF__RF_HIST_H_
35 #define _RF__RF_HIST_H_
37 #include <dev/raidframe/raidframevar.h>
39 #define RF_HIST_RESOLUTION 5
40 #define RF_HIST_MIN_VAL 0
41 #define RF_HIST_MAX_VAL 1000
42 #define RF_HIST_RANGE (RF_HIST_MAX_VAL - RF_HIST_MIN_VAL)
43 #define RF_HIST_NUM_BUCKETS (RF_HIST_RANGE / RF_HIST_RESOLUTION + 1)
45 typedef RF_uint32 RF_Hist_t
;
47 #define RF_HIST_ADD(_hist_,_val_) { \
49 val = ((RF_Hist_t)(_val_)) / 1000; \
50 if (val >= RF_HIST_MAX_VAL) \
51 _hist_[RF_HIST_NUM_BUCKETS-1]++; \
53 _hist_[(val - RF_HIST_MIN_VAL) / RF_HIST_RESOLUTION]++; \
56 #endif /* !_RF__RF_HIST_H_ */