Coda Distributed File System
histo.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2003 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU General Public Licence Version 2, as shown in the
11file LICENSE. The technical and financial contributors to Coda are
12listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef _HISTO_
20#define _HISTO_
21
22/* Histogram scaling */
24{
25 LINEAR = 1,
26 LOG2 = 2,
27 LOG10 = 3
28};
29#define LN2 0.69315 /* natural logarithm of 2.0 */
30#define RAISE2(x) (pow(2.0, 1.0 * (x)))
31#define RAISE10(x) (pow(10.0, 1.0 * (x)))
32
33/* One entry in a histogram. */
34struct histo {
35 /* I know it's not the most efficient in storage.
36 hival and loval are not both necessary.
37 But it makes life so much simpler!
38 */
39 double loval; /* matching values are >= loval */
40 double hival; /* matching values are < hival */
41 int count; /* number of matching values */
42};
43
44/* An entire histogram */
45struct hgram {
46 int maxb; /* number of buckets */
47 enum htype type; /* what kind of histogram */
48 struct histo *buckets; /* malloc'ed array of maxb buckets */
49 struct histo oflow; /* values > buckets[maxb-1].hival */
50 struct histo uflow; /* values < buckets[0].loval */
51 int count; /* total no of entries not in oflow or uflow */
52 double sum; /* sum of values (not in oflow or uflow) */
53 double sum2; /* sum of squares of values (not in oflow or uflow) */
54};
55
56extern int InitHisto(struct hgram *, double, double, int, enum htype);
57extern void ClearHisto(struct hgram *);
58extern void UpdateHisto(struct hgram *, double);
59extern void MUpdateHisto(struct hgram *, double, int);
60extern int PrintHisto(FILE *, struct hgram *);
61extern int PlotHisto(FILE *, struct hgram *, char *, char *, char *, char *);
62#endif /* _HISTO_ */
void ClearHisto(struct hgram *)
Definition: histo.c:107
int InitHisto(struct hgram *, double, double, int, enum htype)
Definition: histo.c:26
htype
Definition: histo.h:24
@ LOG2
Definition: histo.h:26
@ LINEAR
Definition: histo.h:25
@ LOG10
Definition: histo.h:27
void MUpdateHisto(struct hgram *, double, int)
Definition: histo.c:130
int PlotHisto(FILE *, struct hgram *, char *, char *, char *, char *)
Definition: histo.c:240
int PrintHisto(FILE *, struct hgram *)
Definition: histo.c:184
void UpdateHisto(struct hgram *, double)
Definition: histo.c:123
Definition: histo.h:45
struct histo oflow
Definition: histo.h:49
struct histo uflow
Definition: histo.h:50
struct histo * buckets
Definition: histo.h:48
enum htype type
Definition: histo.h:47
int count
Definition: histo.h:51
double sum2
Definition: histo.h:53
int maxb
Definition: histo.h:46
double sum
Definition: histo.h:52
Definition: histo.h:34
double loval
Definition: histo.h:39
int count
Definition: histo.h:41
double hival
Definition: histo.h:40