Coda Distributed File System
resstats.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// statistics collected for resolution
20#include <olist.h>
21
22extern olist ResStatsList;
23
25 int file_nresolves; // total number of file resolves
26 int file_nsucc; // resolves that were successful
27 int file_conf; // resolves that resulted in conflicts
28 int file_runtforce; // resolves that involved forcing a runt
29 int file_we; // resolves due to weak equality
30 int file_reg; // regular file resolves
31 int file_userresolver; // file resolves that invoked a user installed resolver
32 int file_succuserresolve; // number of those resolves that were successful
33 int file_incvsg; // file resolves done with incomplete VSG
34
36};
37
38// histogram for sizes of logs shipped during resolution has buckets for
39// < 1K, 2K, 4K, 8K, ... < 1024K, > 1024K
40#define SHIPHISTOSIZE 12
41#define logshipsizebucketnum(size) \
42 ((!((size) >> 10)) ? \
43 0 : \
44 ((!((size) >> 11)) ? \
45 1 : \
46 ((!((size) >> 12)) ? \
47 2 : \
48 ((!((size) >> 13)) ? \
49 3 : \
50 ((!((size) >> 14)) ? \
51 4 : \
52 ((!((size) >> 15)) ? \
53 5 : \
54 ((!((size) >> 16)) ? \
55 6 : \
56 ((!((size) >> 17)) ? \
57 7 : \
58 ((!((size) >> 18)) ? \
59 8 : \
60 ((!((size) >> 19)) ? \
61 9 : \
62 ((!((size) >> 20)) ? \
63 10 : \
64 11)))))))))))
65
66// histogram for max entries has buckets for
67// entries < 8, 16, 32, 64, 128, 256, 512, 1024, >1024
68#define NENTRIESHISTOSIZE 9
69#define maxentriesbucketnum(i) \
70 ((!((i) >> 3)) ? \
71 0 : \
72 ((!((i) >> 4)) ? \
73 1 : \
74 ((!((i) >> 5)) ? \
75 2 : \
76 ((!((i) >> 6)) ? \
77 3 : \
78 ((!((i) >> 7)) ? \
79 4 : \
80 ((!((i) >> 8)) ? \
81 5 : \
82 ((!((i) >> 9)) ? \
83 6 : \
84 ((!((i) >> 10)) ? 7 : 8))))))))
85
86struct logshiphisto { // histogram of log sizes moved around during dir res
87 int totalsize[SHIPHISTOSIZE]; // distr of total size of logs
89 [NENTRIESHISTOSIZE]; // distr of max entries amongst logs in each res
90
92 void add(int, int *, int);
93 void update(logshiphisto *);
94 void print(int);
95};
96
98 int dir_nresolves; // total number of dir resolves
99 int dir_succ; // resolves that returned successfully
100 int dir_conf; // resolves that marked the object in conflict
101 int dir_nowork; // resolve calls that didn't require any work
102 int dir_problems; // resolve calls with problems(lock, unequal ancestors)
103 int dir_incvsg; // resolve calls with incomplete VSG
104 logshiphisto logshipstats; // info about sizes of logs shipped
105
106 dirresstats();
107};
108
110 int nn; // name/name conflicts
111 int ru; // r/u conflicts
112 int uu; // u/u conflicts
113 int mv; // rename related conflicts
114 int wrap; // conflicts due to log wrap around
115 int other; // unaccounted conflicts
116
118 void update(conflictstats *);
119};
120
121// log statistics
122
123// log size has several parameters
124// for each incarnation of the server the smon db has
125// - highest water mark (highest below) &
126// - size at time of death (currentsize below)
127// the record is "recomputed" and shipped every hour
128// currentsize is updated
129// if high is > highest then highest is updated
130// high is reset to currentsize
131// when the server starts, highest is set to currentsize
132
133#define SIZEBUCKETS 15
134
135struct logsize {
136 int currentsize; // size of log right now
137 int high; // high water mark since previous record was sent
138 int highest; // highest water mark since incarnation
139 int bucket[SIZEBUCKETS]; // histogram of sizes of log when reported
140 // < 1024, < 2048, < 4096,... <8192*1024, >8192*1024
141
142 logsize(int sz = 0);
143 void chgsize(int);
144 void report();
145 void print(int);
146#define logsizebucketnum(size) \
147 ((!((size) >> 10)) ? \
148 0 : \
149 ((!((size) >> 11)) ? \
150 1 : \
151 ((!((size) >> 12)) ? \
152 2 : \
153 ((!((size) >> 13)) ? \
154 3 : \
155 ((!((size) >> 14)) ? \
156 4 : \
157 ((!((size) >> 15)) ? \
158 5 : \
159 ((!((size) >> 16)) ? \
160 6 : \
161 ((!((size) >> 17)) ? \
162 7 : \
163 ((!((size) >> 18)) ? \
164 8 : \
165 ((!((size) >> 19)) ? \
166 9 : \
167 ((!((size) >> 20)) ? \
168 10 : \
169 ((!((size) >> 21)) ? \
170 11 : \
171 ((!((size) >> \
172 22)) ? \
173 12 : \
174 ((!((size) >> \
175 23)) ? \
176 13 : \
177 14))))))))))))))
178};
179
180#define MAXSIZES 9
181struct varlhisto { // distribution of variable length parts for this volume
182 int vallocs; // # of allocs of variable length parts
183 int vfrees; // $ of deallocs of variable length parts
185
186 varlhisto();
187 void countalloc(int);
188 void countdealloc(int);
189 void print(int);
190
191#define varlbucketnum(sz) (((sz) / 8 > 8) ? 8 : ((sz) / 8))
192#define SIZELT8(l) (l).bucket[0]
193#define SIZELT16(l) (l).bucket[1]
194#define SIZELT24(l) (l).bucket[2]
195#define SIZELT32(l) (l).bucket[3]
196#define SIZELT40(l) (l).bucket[4]
197#define SIZELT48(l) (l).bucket[5]
198#define SIZELT56(l) (l).bucket[6]
199#define SIZELT64(l) (l).bucket[7]
200#define SIZEGT64(l) (l).bucket[8]
201};
202
203struct logstats {
204 int nwraps; // number of wrap arounds
205 int nadmgrows; // how many times was admin limit of volume changed
206 varlhisto vdist; // distribution of variable length parts
208
209 logstats(int sz = 0);
210 void print(int);
211};
212
213//typedef enum {project, user, structural, other} VolumeType;
214
215class resstats : public olink {
216public:
217 unsigned long vid;
222
223 resstats(unsigned long, int = 0);
224 void precollect();
225 void postcollect();
226 void update(fileresstats *);
227 void update(dirresstats *);
228 //void update(conflictstats *);
229 //void update(hierarchystats *);
230 //void update(logstats *);
231 void print();
232 void print(FILE *);
233 void print(int);
234};
235
236#define Lsize(l) (l).lstats.lsize
237#define VarlHisto(l) (l).lstats.vdist
Definition: olist.h:47
Definition: resstats.h:215
unsigned long vid
Definition: resstats.h:217
dirresstats dir
Definition: resstats.h:219
void postcollect()
Definition: resstats.cc:228
void precollect()
Definition: resstats.cc:222
logstats lstats
Definition: resstats.h:221
resstats(unsigned long, int=0)
Definition: resstats.cc:216
fileresstats file
Definition: resstats.h:218
conflictstats conf
Definition: resstats.h:220
void print()
Definition: resstats.cc:233
void update(fileresstats *)
Definition: resstats.cc:287
#define SHIPHISTOSIZE
Definition: resstats.h:40
#define SIZEBUCKETS
Definition: resstats.h:133
#define MAXSIZES
Definition: resstats.h:180
olist ResStatsList
Definition: resstats.cc:39
#define NENTRIESHISTOSIZE
Definition: resstats.h:68
Definition: resstats.h:109
conflictstats()
Definition: resstats.cc:110
void update(conflictstats *)
Definition: resstats.cc:115
int other
Definition: resstats.h:115
int uu
Definition: resstats.h:112
int ru
Definition: resstats.h:111
int wrap
Definition: resstats.h:114
int nn
Definition: resstats.h:110
int mv
Definition: resstats.h:113
Definition: resstats.h:97
int dir_nowork
Definition: resstats.h:101
int dir_conf
Definition: resstats.h:100
dirresstats()
Definition: resstats.cc:105
int dir_nresolves
Definition: resstats.h:98
logshiphisto logshipstats
Definition: resstats.h:104
int dir_problems
Definition: resstats.h:102
int dir_incvsg
Definition: resstats.h:103
int dir_succ
Definition: resstats.h:99
Definition: resstats.h:24
int file_incvsg
Definition: resstats.h:33
int file_runtforce
Definition: resstats.h:28
int file_succuserresolve
Definition: resstats.h:32
int file_we
Definition: resstats.h:29
int file_conf
Definition: resstats.h:27
int file_nresolves
Definition: resstats.h:25
int file_reg
Definition: resstats.h:30
int file_userresolver
Definition: resstats.h:31
int file_nsucc
Definition: resstats.h:26
fileresstats()
Definition: resstats.cc:41
Definition: resstats.h:86
logshiphisto()
Definition: resstats.cc:46
void print(int)
Definition: resstats.cc:51
void update(logshiphisto *)
Definition: resstats.cc:94
int totalsize[SHIPHISTOSIZE]
Definition: resstats.h:87
int maxentries[NENTRIESHISTOSIZE]
Definition: resstats.h:89
void add(int, int *, int)
Definition: resstats.cc:81
Definition: resstats.h:135
int currentsize
Definition: resstats.h:136
int bucket[SIZEBUCKETS]
Definition: resstats.h:139
void print(int)
Definition: resstats.cc:143
int high
Definition: resstats.h:137
int highest
Definition: resstats.h:138
logsize(int sz=0)
Definition: resstats.cc:125
void chgsize(int)
Definition: resstats.cc:129
void report()
Definition: resstats.cc:137
Definition: resstats.h:203
void print(int)
Definition: resstats.cc:206
logstats(int sz=0)
Definition: resstats.cc:198
varlhisto vdist
Definition: resstats.h:206
int nadmgrows
Definition: resstats.h:205
int nwraps
Definition: resstats.h:204
logsize lsize
Definition: resstats.h:207
Definition: resstats.h:181
varlhisto()
Definition: resstats.cc:164
int vfrees
Definition: resstats.h:183
void countalloc(int)
Definition: resstats.cc:169
void print(int)
Definition: resstats.cc:182
int bucket[MAXSIZES]
Definition: resstats.h:184
int vallocs
Definition: resstats.h:182
void countdealloc(int)
Definition: resstats.cc:176