rf_hist.h revision 1.1 1 /* $NetBSD: rf_hist.h,v 1.1 1998/11/13 04:20:30 oster Exp $ */
2 /*
3 * rf_hist.h
4 *
5 * Histgram operations for RAIDframe stats
6 */
7 /*
8 * Copyright (c) 1995 Carnegie-Mellon University.
9 * All rights reserved.
10 *
11 * Author: Jim Zelenka
12 *
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.
18 *
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.
22 *
23 * Carnegie Mellon requests users of this software to return to
24 *
25 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
26 * School of Computer Science
27 * Carnegie Mellon University
28 * Pittsburgh PA 15213-3890
29 *
30 * any improvements or extensions that they make and grant Carnegie the
31 * rights to redistribute these changes.
32 */
33 /* :
34 * Log: rf_hist.h,v
35 * Revision 1.3 1996/06/09 02:36:46 jimz
36 * lots of little crufty cleanup- fixup whitespace
37 * issues, comment #ifdefs, improve typing in some
38 * places (esp size-related)
39 *
40 * Revision 1.2 1996/05/31 22:26:54 jimz
41 * fix a lot of mapping problems, memory allocation problems
42 * found some weird lock issues, fixed 'em
43 * more code cleanup
44 *
45 * Revision 1.1 1996/05/31 10:33:05 jimz
46 * Initial revision
47 *
48 */
49
50 #ifndef _RF__RF_HIST_H_
51 #define _RF__RF_HIST_H_
52
53 #include "rf_types.h"
54
55 #define RF_HIST_RESOLUTION 5
56 #define RF_HIST_MIN_VAL 0
57 #define RF_HIST_MAX_VAL 1000
58 #define RF_HIST_RANGE (RF_HIST_MAX_VAL - RF_HIST_MIN_VAL)
59 #define RF_HIST_NUM_BUCKETS (RF_HIST_RANGE / RF_HIST_RESOLUTION + 1)
60
61 typedef RF_uint32 RF_Hist_t;
62
63 #define RF_HIST_ADD(_hist_,_val_) { \
64 RF_Hist_t val; \
65 val = ((RF_Hist_t)(_val_)) / 1000; \
66 if (val >= RF_HIST_MAX_VAL) \
67 _hist_[RF_HIST_NUM_BUCKETS-1]++; \
68 else \
69 _hist_[(val - RF_HIST_MIN_VAL) / RF_HIST_RESOLUTION]++; \
70 }
71
72 #endif /* !_RF__RF_HIST_H_ */
73