2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Statistics gathering stuff for the AFS cache manager.
14 * The remainder of this file contains the statistics gathering stuff.
17 #ifndef __OPENAFS_AFS_STATS_H__
18 #define __OPENAFS_AFS_STATS_H__
20 #include "afs/param.h"
22 /* the following is to work around a VAX compiler limitation */
26 #endif /* VAX environment */
31 * The data collection routines are simply no-ops
33 #define AFS_STATCNT(arg)
34 #define AFS_MEANCNT(arg, value)
35 #define AFS_STATS(arg)
37 #define XSTATS_START_TIME(arg)
38 #define XSTATS_START_CMTIME(arg)
39 #define XSTATS_END_TIME
41 #else /* AFS_NOSTATS */
43 #define AFS_STATS(arg) arg
45 /* NOTE: Ensure this is the same size in user and kernel mode. */
52 #define XSTATS_DECLS struct afs_stats_opTimingData *opP = NULL; \
53 osi_timeval_t opStartTime = { 0, 0}, opStopTime, elapsedTime
55 #define XSTATS_START_TIME(arg) \
56 opP = &(afs_stats_cmfullperf.rpc.fsRPCTimes[arg]); \
57 osi_GetuTime(&opStartTime);
59 #define XSTATS_START_CMTIME(arg) \
60 opP = &(afs_stats_cmfullperf.rpc.cmRPCTimes[arg]); \
61 osi_GetuTime(&opStartTime);
63 #define XSTATS_END_TIME osi_GetuTime(&opStopTime); \
65 if (!code) { (opP->numSuccesses)++; \
66 afs_stats_GetDiff(elapsedTime, opStartTime, opStopTime); \
67 afs_stats_AddTo((opP->sumTime), elapsedTime); \
68 afs_stats_SquareAddTo((opP->sqrTime), elapsedTime); \
69 if (afs_stats_TimeLessThan(elapsedTime, (opP->minTime))) { \
70 afs_stats_TimeAssign((opP->minTime), elapsedTime); \
71 } if (afs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) { \
72 afs_stats_TimeAssign((opP->maxTime), elapsedTime); } }
74 #endif /* AFS_NOSTATS */
78 struct afs_MeanStats
{
84 * struct afs_CMCallStats
85 * This is the place where we keep records on each and every
88 * This structure is encoded as a binary blob and thrown at the client
89 * for use by the xstat_cm interface. As the datastructure is unversioned,
91 * *) Never add elements to the middle of the list. Everything new
93 * *) Never remove elements from the list. If a function dies, don't
94 * remove it's entry here (by all means, flag it as dead, though)
95 * *) Never make elements conditional on preprocessor symbols. Doing
96 * this would mean that the client has to be built with exactly
97 * the same options as you are. Which isn't a great idea.
100 #define AFS_CM_CALL_STATS \
101 AFS_CS(afs_init) /* afs_aix_subr.c */ \
102 AFS_CS(gop_rdwr) /* afs_aix_subr.c */ \
103 AFS_CS(aix_gnode_rele) /* afs_aix_subr.c */ \
104 AFS_CS(gettimeofday) /* afs_aix_subr.c */ \
105 AFS_CS(m_cpytoc) /* afs_aix_subr.c */ \
106 AFS_CS(aix_vattr_null) /* afs_aix_subr.c */ \
107 AFS_CS(afs_gn_ftrunc) /* afs_aixops.c */ \
108 AFS_CS(afs_gn_rdwr) /* afs_aixops.c */ \
109 AFS_CS(afs_gn_ioctl) /* afs_aixops.c */ \
110 AFS_CS(afs_gn_lockctl) /* afs_aixops.c */ \
111 AFS_CS(afs_gn_readlink) /* afs_aixops.c */ \
112 AFS_CS(afs_gn_readdir) /* afs_aixops.c */ \
113 AFS_CS(afs_gn_select) /* afs_aixops.c */ \
114 AFS_CS(afs_gn_strategy) /* afs_aixops.c */ \
115 AFS_CS(afs_gn_symlink) /* afs_aixops.c */ \
116 AFS_CS(afs_gn_revoke) /* afs_aixops.c */ \
117 AFS_CS(afs_gn_link) /* afs_aixops.c */ \
118 AFS_CS(afs_gn_mkdir) /* afs_aixops.c */ \
119 AFS_CS(afs_gn_mknod) /* afs_aixops.c */ \
120 AFS_CS(afs_gn_remove) /* afs_aixops.c */ \
121 AFS_CS(afs_gn_rename) /* afs_aixops.c */ \
122 AFS_CS(afs_gn_rmdir) /* afs_aixops.c */ \
123 AFS_CS(afs_gn_fid) /* afs_aixops.c */ \
124 AFS_CS(afs_gn_lookup) /* afs_aixops.c */ \
125 AFS_CS(afs_gn_open) /* afs_aixops.c */ \
126 AFS_CS(afs_gn_create) /* afs_aixops.c */ \
127 AFS_CS(afs_gn_hold) /* afs_aixops.c */ \
128 AFS_CS(afs_gn_close) /* afs_aixops.c */ \
129 AFS_CS(afs_gn_map) /* afs_aixops.c */ \
130 AFS_CS(afs_gn_rele) /* afs_aixops.c */ \
131 AFS_CS(afs_gn_unmap) /* afs_aixops.c */ \
132 AFS_CS(afs_gn_access) /* afs_aixops.c */ \
133 AFS_CS(afs_gn_getattr) /* afs_aixops.c */ \
134 AFS_CS(afs_gn_setattr) /* afs_aixops.c */ \
135 AFS_CS(afs_gn_fclear) /* afs_aixops.c */ \
136 AFS_CS(afs_gn_fsync) /* afs_aixops.c */ \
137 AFS_CS(pHash) /* afs_buffer.c */ \
138 AFS_CS(DInit) /* afs_buffer.c */ \
139 AFS_CS(DRead) /* afs_buffer.c */ \
140 AFS_CS(FixupBucket) /* afs_buffer.c */ \
141 AFS_CS(afs_newslot) /* afs_buffer.c */ \
142 AFS_CS(DRelease) /* afs_buffer.c */ \
143 AFS_CS(DFlush) /* afs_buffer.c */ \
144 AFS_CS(DFlushEntry) /* afs_buffer.c */ \
145 AFS_CS(DVOffset) /* afs_buffer.c */ \
146 AFS_CS(DZap) /* afs_buffer.c */ \
147 AFS_CS(DNew) /* afs_buffer.c */ \
148 AFS_CS(shutdown_bufferpackage) /* afs_buffer.c */ \
149 AFS_CS(afs_CheckKnownBad) /* afs_cache.c */ \
150 AFS_CS(afs_RemoveVCB) /* afs_cache.c */ \
151 AFS_CS(afs_NewVCache) /* afs_cache.c */ \
152 AFS_CS(afs_FlushActiveVcaches) /* afs_cache.c */ \
153 AFS_CS(afs_VerifyVCache) /* afs_cache.c */ \
154 AFS_CS(afs_WriteVCache) /* afs_cache.c */ \
155 AFS_CS(afs_GetVCache) /* afs_cache.c */ \
156 AFS_CS(afs_StuffVcache) /* afs_cache.c */ \
157 AFS_CS(afs_FindVCache) /* afs_cache.c */ \
158 AFS_CS(afs_PutDCache) /* afs_cache.c */ \
159 AFS_CS(afs_PutVCache) /* afs_cache.c */ \
160 AFS_CS(CacheStoreProc) /* afs_cache.c */ \
161 AFS_CS(afs_FindDCache) /* afs_cache.c */ \
162 AFS_CS(afs_TryToSmush) /* afs_cache.c */ \
163 AFS_CS(afs_AdjustSize) /* afs_cache.c */ \
164 AFS_CS(afs_CheckSize) /* afs_cache.c */ \
165 AFS_CS(afs_StoreWarn) /* afs_cache.c */ \
166 AFS_CS(CacheFetchProc) /* afs_cache.c */ \
167 AFS_CS(UFS_CacheStoreProc) /* afs_cache.c */ \
168 AFS_CS(UFS_CacheFetchProc) /* afs_cache.c */ \
169 AFS_CS(afs_GetDCache) /* afs_cache.c */ \
170 AFS_CS(afs_SimpleVStat) /* afs_cache.c */ \
171 AFS_CS(afs_ProcessFS) /* afs_cache.c */ \
172 AFS_CS(afs_InitCacheInfo) /* afs_cache.c */ \
173 AFS_CS(afs_InitVolumeInfo) /* afs_cache.c */ \
174 AFS_CS(afs_InitCacheFile) /* afs_cache.c */ \
175 AFS_CS(afs_CacheInit) /* afs_cache.c */ \
176 AFS_CS(afs_GetDSlot) /* afs_cache.c */ \
177 AFS_CS(afs_WriteThroughDSlots) /* afs_cache.c */ \
178 AFS_CS(afs_MemGetDSlot) /* afs_cache.c */ \
179 AFS_CS(afs_UFSGetDSlot) /* afs_cache.c */ \
180 AFS_CS(afs_StoreDCache) /* afs_cache.c */ \
181 AFS_CS(afs_StoreMini) /* afs_cache.c */ \
182 AFS_CS(shutdown_cache) /* afs_cache.c */ \
183 AFS_CS(afs_StoreAllSegments) /* afs_cache.c */ \
184 AFS_CS(afs_InvalidateAllSegments) /* afs_cache.c */ \
185 AFS_CS(afs_TruncateAllSegments) /* afs_cache.c */ \
186 AFS_CS(afs_CheckVolSync) /* afs_cache.c */ \
187 AFS_CS(afs_wakeup) /* afs_cache.c */ \
188 AFS_CS(afs_CFileOpen) /* afs_cache.c */ \
189 AFS_CS(afs_CFileTruncate) /* afs_cache.c */ \
190 AFS_CS(afs_GetDownD) /* afs_cache.c */ \
191 AFS_CS(afs_WriteDCache) /* afs_cache.c */ \
192 AFS_CS(afs_FlushDCache) /* afs_cache.c */ \
193 AFS_CS(afs_GetDownDSlot) /* afs_cache.c */ \
194 AFS_CS(afs_FlushVCache) /* afs_cache.c */ \
195 AFS_CS(afs_GetDownV) /* afs_cache.c */ \
196 AFS_CS(afs_QueueVCB) /* afs_cache.c */ \
197 AFS_CS(afs_call) /* afs_call.c */ \
198 AFS_CS(afs_syscall_call) /* afs_call.c */ \
199 AFS_CS(syscall) /* afs_call.c */ \
200 AFS_CS(lpioctl) /* afs_call.c */ \
201 AFS_CS(lsetpag) /* afs_call.c */ \
202 AFS_CS(afs_syscall) /* afs_call.c */ \
203 AFS_CS(afs_CheckInit) /* afs_call.c */ \
204 AFS_CS(afs_shutdown) /* afs_call.c */ \
205 AFS_CS(shutdown_BKG) /* afs_call.c */ \
206 AFS_CS(shutdown_afstest) /* afs_call.c */ \
207 AFS_CS(SRXAFSCB_GetCE) /* afs_callback.c */ \
208 AFS_CS(ClearCallBack) /* afs_callback.c */ \
209 AFS_CS(SRXAFSCB_GetLock) /* afs_callback.c */ \
210 AFS_CS(SRXAFSCB_CallBack) /* afs_callback.c */ \
211 AFS_CS(SRXAFSCB_InitCallBackState) /* afs_callback.c */ \
212 AFS_CS(SRXAFSCB_Probe) /* afs_callback.c */ \
213 AFS_CS(afs_RXCallBackServer) /* afs_callback.c */ \
214 AFS_CS(shutdown_CB) /* afs_callback.c */ \
215 AFS_CS(afs_Chunk) /* afs_chunk.c */ \
216 AFS_CS(afs_ChunkBase) /* afs_chunk.c */ \
217 AFS_CS(afs_ChunkOffset) /* afs_chunk.c */ \
218 AFS_CS(afs_ChunkSize) /* afs_chunk.c */ \
219 AFS_CS(afs_ChunkToBase) /* afs_chunk.c */ \
220 AFS_CS(afs_ChunkToSize) /* afs_chunk.c */ \
221 AFS_CS(afs_SetChunkSize) /* afs_chunk.c */ \
222 AFS_CS(afs_config) /* afs_config.c */ \
223 AFS_CS(mem_freebytes) /* afs_config.c */ \
224 AFS_CS(mem_getbytes) /* afs_config.c */ \
225 AFS_CS(fpalloc) /* afs_config.c */ \
226 AFS_CS(kluge_init) /* afs_config.c */ \
227 AFS_CS(ufdalloc) /* afs_config.c */ \
228 AFS_CS(ufdfree) /* afs_config.c */ \
229 AFS_CS(commit) /* afs_config.c */ \
230 AFS_CS(dev_ialloc) /* afs_config.c */ \
231 AFS_CS(ffree) /* afs_config.c */ \
232 AFS_CS(iget) /* afs_config.c */ \
233 AFS_CS(iptovp) /* afs_config.c */ \
234 AFS_CS(ilock) /* afs_config.c */ \
235 AFS_CS(irele) /* afs_config.c */ \
236 AFS_CS(iput) /* afs_config.c */ \
237 AFS_CS(afs_Daemon) /* afs_daemons.c */ \
238 AFS_CS(afs_CheckRootVolume) /* afs_daemons.c */ \
239 AFS_CS(BPath) /* afs_daemons.c */ \
240 AFS_CS(BPrefetch) /* afs_daemons.c */ \
241 AFS_CS(BStore) /* afs_daemons.c */ \
242 AFS_CS(afs_BBusy) /* afs_daemons.c */ \
243 AFS_CS(afs_BQueue) /* afs_daemons.c */ \
244 AFS_CS(afs_BRelease) /* afs_daemons.c */ \
245 AFS_CS(afs_BackgroundDaemon) /* afs_daemons.c */ \
246 AFS_CS(shutdown_daemons) /* afs_daemons.c */ \
247 AFS_CS(exporter_add) /* afs_exporter.c */ \
248 AFS_CS(exporter_find) /* afs_exporter.c */ \
249 AFS_CS(afs_gfs_kalloc) /* afs_gfs_subr.c */ \
250 AFS_CS(IsAfsVnode) /* afs_gfs_subr.c */ \
251 AFS_CS(SetAfsVnode) /* afs_gfs_subr.c */ \
252 AFS_CS(afs_gfs_kfree) /* afs_gfs_subr.c */ \
253 AFS_CS(gop_lookupname) /* afs_gfs_subr.c */ \
254 AFS_CS(gfsvop_getattr) /* afs_gfs_subr.c */ \
255 AFS_CS(gfsvop_rdwr) /* afs_gfs_subr.c */ \
256 AFS_CS(afs_uniqtime) /* afs_gfs_subr.c */ \
257 AFS_CS(gfs_vattr_null) /* afs_gfs_subr.c */ \
258 AFS_CS(afs_lock) /* afs_gfsops.c */ \
259 AFS_CS(afs_unlock) /* afs_gfsops.c */ \
260 AFS_CS(afs_update) /* afs_gfsops.c */ \
261 AFS_CS(afs_gclose) /* afs_gfsops.c */ \
262 AFS_CS(afs_gopen) /* afs_gfsops.c */ \
263 AFS_CS(afs_greadlink) /* afs_gfsops.c */ \
264 AFS_CS(afs_select) /* afs_gfsops.c */ \
265 AFS_CS(afs_gbmap) /* afs_gfsops.c */ \
266 AFS_CS(afs_getfsdata) /* afs_gfsops.c */ \
267 AFS_CS(afs_gsymlink) /* afs_gfsops.c */ \
268 AFS_CS(afs_namei) /* afs_gfsops.c */ \
269 AFS_CS(printgnode) /* afs_gfsops.c */ \
270 AFS_CS(HaveGFSLock) /* afs_gfsops.c */ \
271 AFS_CS(afs_gmount) /* afs_gfsops.c */ \
272 AFS_CS(AddGFSLock) /* afs_gfsops.c */ \
273 AFS_CS(RemoveGFSLock) /* afs_gfsops.c */ \
274 AFS_CS(afs_grlock) /* afs_gfsops.c */ \
275 AFS_CS(afs_gumount) /* afs_gfsops.c */ \
276 AFS_CS(afs_gget) /* afs_gfsops.c */ \
277 AFS_CS(afs_glink) /* afs_gfsops.c */ \
278 AFS_CS(afs_gmkdir) /* afs_gfsops.c */ \
279 AFS_CS(afs_sbupdate) /* afs_gfsops.c */ \
280 AFS_CS(afs_unlink) /* afs_gfsops.c */ \
281 AFS_CS(afs_grmdir) /* afs_gfsops.c */ \
282 AFS_CS(afs_makenode) /* afs_gfsops.c */ \
283 AFS_CS(afs_grename) /* afs_gfsops.c */ \
284 AFS_CS(afs_rele) /* afs_gfsops.c */ \
285 AFS_CS(afs_syncgp) /* afs_gfsops.c */ \
286 AFS_CS(afs_getval) /* afs_gfsops.c */ \
287 AFS_CS(afs_gfshack) /* afs_gfsops.c */ \
288 AFS_CS(afs_trunc) /* afs_gfsops.c */ \
289 AFS_CS(afs_rwgp) /* afs_gfsops.c */ \
290 AFS_CS(afs_stat) /* afs_gfsops.c */ \
291 AFS_CS(afsc_link) /* afs_hp_subr.c */ \
292 AFS_CS(hpsobind) /* afs_hp_subr.c */ \
293 AFS_CS(hpsoclose) /* afs_hp_subr.c */ \
294 AFS_CS(hpsocreate) /* afs_hp_subr.c */ \
295 AFS_CS(hpsoreserve) /* afs_hp_subr.c */ \
296 AFS_CS(afs_vfs_mount) /* afs_hp_subr.c */ \
297 AFS_CS(devtovfs) /* afs_istuff.c */ \
298 AFS_CS(igetinode) /* afs_istuff.c */ \
299 AFS_CS(afs_syscall_iopen) /* afs_istuff.c */ \
300 AFS_CS(iopen) /* afs_istuff.c */ \
301 AFS_CS(afs_syscall_iincdec) /* afs_istuff.c */ \
302 AFS_CS(afs_syscall_ireadwrite) /* afs_istuff.c */ \
303 AFS_CS(iincdec) /* afs_istuff.c */ \
304 AFS_CS(ireadwrite) /* afs_istuff.c */ \
305 AFS_CS(oiread) /* afs_istuff.c */ \
306 AFS_CS(AHash) /* afs_istuff.c */ \
307 AFS_CS(QTOA) /* afs_istuff.c */ \
308 AFS_CS(afs_FindPartByDev) /* afs_istuff.c */ \
309 AFS_CS(aux_init) /* afs_istuff.c */ \
310 AFS_CS(afs_GetNewPart) /* afs_istuff.c */ \
311 AFS_CS(afs_InitAuxVolFile) /* afs_istuff.c */ \
312 AFS_CS(afs_CreateAuxEntry) /* afs_istuff.c */ \
313 AFS_CS(afs_GetAuxSlot) /* afs_istuff.c */ \
314 AFS_CS(afs_GetDownAux) /* afs_istuff.c */ \
315 AFS_CS(afs_FlushAuxCache) /* afs_istuff.c */ \
316 AFS_CS(afs_GetAuxInode) /* afs_istuff.c */ \
317 AFS_CS(afs_PutAuxInode) /* afs_istuff.c */ \
318 AFS_CS(afs_ReadAuxInode) /* afs_istuff.c */ \
319 AFS_CS(afs_WriteAuxInode) /* afs_istuff.c */ \
320 AFS_CS(afs_auxcall) /* afs_istuff.c */ \
321 AFS_CS(tmpdbg_auxtbl) /* afs_istuff.c */ \
322 AFS_CS(tmpdbg_parttbl) /* afs_istuff.c */ \
323 AFS_CS(idec) /* afs_istuff.c */ \
324 AFS_CS(iinc) /* afs_istuff.c */ \
325 AFS_CS(iread) /* afs_istuff.c */ \
326 AFS_CS(iwrite) /* afs_istuff.c */ \
327 AFS_CS(getinode) /* afs_istuff.c */ \
328 AFS_CS(trygetfs) /* afs_istuff.c */ \
329 AFS_CS(iforget) /* afs_istuff.c */ \
330 AFS_CS(afs_syscall_icreate) /* afs_istuff.c */ \
331 AFS_CS(icreate) /* afs_istuff.c */ \
332 AFS_CS(Lock_Init) /* afs_lock.c */ \
333 AFS_CS(Lock_Obtain) /* afs_lock.c */ \
334 AFS_CS(Lock_ReleaseR) /* afs_lock.c */ \
335 AFS_CS(Lock_ReleaseW) /* afs_lock.c */ \
336 AFS_CS(afs_BozonLock) /* UNUSED */ \
337 AFS_CS(afs_BozonUnlock) /* UNUSED */ \
338 AFS_CS(osi_SleepR) /* afs_lock.c */ \
339 AFS_CS(osi_SleepS) /* afs_lock.c */ \
340 AFS_CS(osi_SleepW) /* afs_lock.c */ \
341 AFS_CS(osi_Sleep) /* afs_lock */ \
342 AFS_CS(afs_BozonInit) /* UNUSED */ \
343 AFS_CS(afs_CheckBozonLock) /* UNUSED */ \
344 AFS_CS(afs_CheckBozonLockBlocking) /* UNUSED */ \
345 AFS_CS(xxxinit) /* afs_main.c */ \
346 AFS_CS(KernelEntry) /* afs_main.c */ \
347 AFS_CS(afs_InitMemCache) /* afs_memcache.c */ \
348 AFS_CS(afs_LookupMCE) /* afs_memcache.c */ \
349 AFS_CS(afs_MemReadBlk) /* afs_memcache.c */ \
350 AFS_CS(afs_MemReadUIO) /* afs_memcache.c */ \
351 AFS_CS(afs_MemWriteBlk) /* afs_memcache.c */ \
352 AFS_CS(afs_MemCacheStoreProc) /* afs_memcache.c */ \
353 AFS_CS(afs_MemCacheTruncate) /* afs_memcache.c */ \
354 AFS_CS(afs_MemWriteUIO) /* afs_memcache.c */ \
355 AFS_CS(afs_MemCacheFetchProc) /* afs_memcache.c */ \
356 AFS_CS(afs_vnode_pager_create) /* afs_next_aux.c */ \
357 AFS_CS(next_KernelEntry) /* afs_next_subr.c */ \
358 AFS_CS(afs_GetNfsClientPag) /* afs_nfsclnt.c */ \
359 AFS_CS(afs_FindNfsClientPag) /* afs_nfsclnt.c */ \
360 AFS_CS(afs_PutNfsClientPag) /* afs_nfsclnt.c */ \
361 AFS_CS(afs_nfsclient_reqhandler) /* afs_nfsclnt.c */ \
362 AFS_CS(afs_nfsclient_GC) /* afs_nfsclnt.c */ \
363 AFS_CS(afs_nfsclient_hold) /* afs_nfsclnt.c */ \
364 AFS_CS(afs_nfsclient_stats) /* afs_nfsclnt.c */ \
365 AFS_CS(afs_nfsclient_sysname) /* afs_nfsclnt.c */ \
366 AFS_CS(afs_nfsclient_shutdown) /* afs_nfsclnt.c */ \
367 AFS_CS(afs_rfs_readdir_fixup) /* afs_nfssrv.c */ \
368 AFS_CS(afs_rfs_dispatch) /* afs_nfssrv.c */ \
369 AFS_CS(afs_xnfs_svc) /* afs_nfssrv.c */ \
370 AFS_CS(afs_xdr_putrddirres) /* afs_nfssrv.c */ \
371 AFS_CS(afs_rfs_readdir) /* afs_nfssrv.c */ \
372 AFS_CS(afs_rfs_rddirfree) /* afs_nfssrv.c */ \
373 AFS_CS(rfs_dupcreate) /* afs_nfssrv.c */ \
374 AFS_CS(rfs_dupsetattr) /* afs_nfssrv.c */ \
375 AFS_CS(Nfs2AfsCall) /* afs_nfssrv.c */ \
376 AFS_CS(afs_sun_xuntext) /* afs_osi.c */ \
377 AFS_CS(osi_Active) /* afs_osi.c */ \
378 AFS_CS(osi_FlushPages) /* afs_osi.c */ \
379 AFS_CS(osi_FlushText) /* afs_osi.c */ \
380 AFS_CS(osi_CallProc) /* afs_osi.c */ \
381 AFS_CS(osi_CancelProc) /* afs_osi.c */ \
382 AFS_CS(osi_Invisible) /* afs_osi.c */ \
383 AFS_CS(osi_Time) /* afs_osi.c */ \
384 AFS_CS(osi_Alloc) /* afs_osi_alloc.c */ \
385 AFS_CS(osi_SetTime) /* afs_osi.c */ \
386 AFS_CS(osi_Dump) /* afs_osi.c */ \
387 AFS_CS(osi_Free) /* afs_osi_alloc.c */ \
388 AFS_CS(shutdown_osi) /* afs_osi.c */ \
389 AFS_CS(osi_UFSOpen) /* afs_osifile.c */ \
390 AFS_CS(osi_Close) /* afs_osifile.c */ \
391 AFS_CS(osi_Stat) /* afs_osifile.c */ \
392 AFS_CS(osi_Truncate) /* afs_osifile.c */ \
393 AFS_CS(osi_Read) /* afs_osifile.c */ \
394 AFS_CS(osi_Write) /* afs_osifile.c */ \
395 AFS_CS(osi_MapStrategy) /* afs_osifile.c */ \
396 AFS_CS(shutdown_osifile) /* afs_osifile.c */ \
397 AFS_CS(osi_FreeLargeSpace) /* afs_osi_alloc.c */ \
398 AFS_CS(osi_FreeSmallSpace) /* afs_osi_alloc.c */ \
399 AFS_CS(pkt_iodone) /* afs_osinet.c */ \
400 AFS_CS(shutdown_osinet) /* afs_osi_alloc.c */ \
401 AFS_CS(afs_cs) /* afs_osinet.c */ \
402 AFS_CS(osi_AllocLargeSpace) /* afs_osi_alloc.c */ \
403 AFS_CS(osi_AllocSmallSpace) /* afs_osi_alloc.c */ \
404 AFS_CS(osi_CloseToTheEdge) /* afs_osinet.c */ \
405 AFS_CS(osi_xgreedy) /* afs_osinet.c */ \
406 AFS_CS(osi_FreeSocket) /* afs_osinet.c */ \
407 AFS_CS(osi_NewSocket) /* afs_osinet.c */ \
408 AFS_CS(trysblock) /* afs_osinet.c */ \
409 AFS_CS(osi_NetSend) /* afs_osinet.c */ \
410 AFS_CS(WaitHack) /* afs_osinet.c */ \
411 AFS_CS(osi_CancelWait) /* afs_osinet.c */ \
412 AFS_CS(osi_InitWaitHandle) /* afs_osinet.c */ \
413 AFS_CS(osi_Wakeup) /* afs_osinet.c */ \
414 AFS_CS(osi_Wait) /* afs_osinet.c */ \
415 AFS_CS(dirp_Read) /* afs_physio.c */ \
416 AFS_CS(dirp_SetCacheDev) /* afs_physio.c */ \
417 AFS_CS(Die) /* afs_physio.c */ \
418 AFS_CS(dirp_Cpy) /* afs_physio.c */ \
419 AFS_CS(dirp_Eq) /* afs_physio.c */ \
420 AFS_CS(dirp_Write) /* afs_physio.c */ \
421 AFS_CS(dirp_Zap) /* afs_physio.c */ \
422 AFS_CS(PSetVolumeStatus) /* afs_pioctl.c */ \
423 AFS_CS(PFlush) /* afs_pioctl.c */ \
424 AFS_CS(PNewStatMount) /* afs_pioctl.c */ \
425 AFS_CS(PGetTokens) /* afs_pioctl.c */ \
426 AFS_CS(PUnlog) /* afs_pioctl.c */ \
427 AFS_CS(PCheckServers) /* afs_pioctl.c */ \
428 AFS_CS(PMariner) /* afs_pioctl.c */ \
429 AFS_CS(PCheckAuth) /* afs_pioctl.c */ \
430 AFS_CS(PCheckVolNames) /* afs_pioctl.c */ \
431 AFS_CS(PFindVolume) /* afs_pioctl.c */ \
432 AFS_CS(Prefetch) /* afs_pioctl.c */ \
433 AFS_CS(PGetCacheSize) /* afs_pioctl.c */ \
434 AFS_CS(PRemoveCallBack) /* afs_pioctl.c */ \
435 AFS_CS(PSetCacheSize) /* afs_pioctl.c */ \
436 AFS_CS(PViceAccess) /* afs_pioctl.c */ \
437 AFS_CS(PListCells) /* afs_pioctl.c */ \
438 AFS_CS(PNewCell) /* afs_pioctl.c */ \
439 AFS_CS(PRemoveMount) /* afs_pioctl.c */ \
440 AFS_CS(HandleIoctl) /* afs_pioctl.c */ \
441 AFS_CS(_AFSIOCTL) /* afs_pioctl.c */ \
442 AFS_CS(_VALIDAFSIOCTL) /* afs_pioctl.c */ \
443 AFS_CS(PGetCellStatus) /* afs_pioctl.c */ \
444 AFS_CS(PSetCellStatus) /* afs_pioctl.c */ \
445 AFS_CS(PVenusLogging) /* afs_pioctl.c */ \
446 AFS_CS(PFlushVolumeData) /* afs_pioctl.c */ \
447 AFS_CS(PSetSysName) /* afs_pioctl.c */ \
448 AFS_CS(PExportAfs) /* afs_pioctl.c */ \
449 AFS_CS(HandleClientContext) /* afs_pioctl.c */ \
450 AFS_CS(afs_ioctl) /* afs_pioctl.c */ \
451 AFS_CS(afs_xioctl) /* afs_pioctl.c */ \
452 AFS_CS(afs_pioctl) /* afs_pioctl.c */ \
453 AFS_CS(afs_syscall_pioctl) /* afs_pioctl.c */ \
454 AFS_CS(HandlePioctl) /* afs_pioctl.c */ \
455 AFS_CS(PGetAcl) /* afs_pioctl.c */ \
456 AFS_CS(PGetFID) /* afs_pioctl.c */ \
457 AFS_CS(PSetAcl) /* afs_pioctl.c */ \
458 AFS_CS(PBogus) /* afs_pioctl.c */ \
459 AFS_CS(PGetFileCell) /* afs_pioctl.c */ \
460 AFS_CS(PGetWSCell) /* afs_pioctl.c */ \
461 AFS_CS(PNoop) /* afs_pioctl.c */ \
462 AFS_CS(PGetUserCell) /* afs_pioctl.c */ \
463 AFS_CS(PSetTokens) /* afs_pioctl.c */ \
464 AFS_CS(PGetVolumeStatus) /* afs_pioctl.c */ \
465 AFS_CS(afs_ResetAccessCache) /* afs_resource.c */ \
466 AFS_CS(afs_FindUser) /* afs_resource.c */ \
467 AFS_CS(afs_ResetUserConns) /* afs_resource.c */ \
468 AFS_CS(afs_ResourceInit) /* afs_resource.c */ \
469 AFS_CS(afs_GetCell) /* afs_resource.c */ \
470 AFS_CS(afs_GetCellByIndex) /* afs_resource.c */ \
471 AFS_CS(afs_GetCellByName) /* afs_resource.c */ \
472 AFS_CS(afs_GetRealCellByIndex) /* afs_resource.c */ \
473 AFS_CS(afs_NewCell) /* afs_resource.c */ \
474 AFS_CS(afs_GetUser) /* afs_resource.c */ \
475 AFS_CS(afs_PutUser) /* afs_resource.c */ \
476 AFS_CS(afs_SetPrimary) /* afs_resource.c */ \
477 AFS_CS(CheckVLDB) /* afs_resource.c */ \
478 AFS_CS(afs_GetVolume) /* afs_resource.c */ \
479 AFS_CS(afs_GetVolumeByName) /* afs_resource.c */ \
480 AFS_CS(InstallVolumeEntry) /* afs_resource.c */ \
481 AFS_CS(InstallVolumeInfo) /* afs_resource.c */ \
482 AFS_CS(afs_FindServer) /* afs_resource.c */ \
483 AFS_CS(afs_PutVolume) /* afs_resource.c */ \
484 AFS_CS(afs_random) /* afs_resource.c */ \
485 AFS_CS(ranstage) /* afs_resource.c */ \
486 AFS_CS(RemoveUserConns) /* afs_resource.c */ \
487 AFS_CS(afs_MarinerLog) /* afs_resource.c */ \
488 AFS_CS(afs_vtoi) /* afs_resource.c */ \
489 AFS_CS(afs_GetServer) /* afs_resource.c */ \
490 AFS_CS(afs_SortServers) /* afs_resource.c */ \
491 AFS_CS(afs_Conn) /* afs_resource.c */ \
492 AFS_CS(afs_ConnByHost) /* afs_resource.c */ \
493 AFS_CS(afs_ConnByMHosts) /* afs_resource.c */ \
494 AFS_CS(afs_Analyze) /* afs_resource.c */ \
495 AFS_CS(afs_PutConn) /* afs_resource.c */ \
496 AFS_CS(afs_ResetVolumeInfo) /* afs_resource.c */ \
497 AFS_CS(StartLogFile) /* afs_resource.c */ \
498 AFS_CS(afs_SetLogFile) /* afs_resource.c */ \
499 AFS_CS(EndLogFile) /* afs_resource.c */ \
500 AFS_CS(afs_dp) /* afs_resource.c */ \
501 AFS_CS(fprf) /* afs_resource.c */ \
502 AFS_CS(fprint) /* afs_resource.c */ \
503 AFS_CS(fprintn) /* afs_resource.c */ \
504 AFS_CS(afs_CheckLocks) /* afs_resource.c */ \
505 AFS_CS(puttofile) /* afs_resource.c */ \
506 AFS_CS(shutdown_AFS) /* afs_resource.c */ \
507 AFS_CS(afs_CheckCacheResets) /* afs_resource.c */ \
508 AFS_CS(afs_GCUserData) /* afs_resource.c */ \
509 AFS_CS(VSleep) /* afs_resource.c */ \
510 AFS_CS(afs_CheckCode) /* afs_resource.c */ \
511 AFS_CS(afs_CopyError) /* afs_resource.c */ \
512 AFS_CS(afs_FinalizeReq) /* afs_resource.c */ \
513 AFS_CS(afs_cv2string) /* afs_resource.c */ \
514 AFS_CS(afs_FindVolCache) /* afs_resource.c */ \
515 AFS_CS(afs_GetVolCache) /* afs_resource.c */ \
516 AFS_CS(afs_GetVolSlot) /* afs_resource.c */ \
517 AFS_CS(afs_WriteVolCache) /* afs_resource.c */ \
518 AFS_CS(afs_UFSGetVolSlot) /* afs_resource.c */ \
519 AFS_CS(afs_CheckVolumeNames) /* afs_resource.c */ \
520 AFS_CS(afs_MemGetVolSlot) /* afs_resource.c */ \
521 AFS_CS(print_internet_address) /* afs_resource.c */ \
522 AFS_CS(CheckVLServer) /* afs_resource.c */ \
523 AFS_CS(HaveCallBacksFrom) /* afs_resource.c */ \
524 AFS_CS(ServerDown) /* afs_resource.c */ \
525 AFS_CS(afs_CheckServers) /* afs_resource.c */ \
526 AFS_CS(afs_AddToMean) /* afs_stat.c */ \
527 AFS_CS(afs_GetCMStat) /* afs_stat.c */ \
528 AFS_CS(afs_getpage) /* afs_sun_subr.c */ \
529 AFS_CS(afs_putpage) /* afs_sun_subr.c */ \
530 AFS_CS(afs_nfsrdwr) /* afs_sun_subr.c */ \
531 AFS_CS(afs_map) /* afs_sun_subr.c */ \
532 AFS_CS(afs_cmp) /* afs_sun_subr.c */ \
533 AFS_CS(afs_cntl) /* afs_sun_subr.c */ \
534 AFS_CS(afs_dump) /* afs_sun_subr.c */ \
535 AFS_CS(afs_realvp) /* afs_sun_subr.c */ \
536 AFS_CS(afs_PageLeft) /* afs_sun_subr.c */ \
537 AFS_CS(afsinit) /* afs_vfsops.c */ \
538 AFS_CS(afs_mount) /* afs_vfsops.c */ \
539 AFS_CS(afs_unmount) /* afs_vfsops.c */ \
540 AFS_CS(afs_root) /* afs_vfsops.c */ \
541 AFS_CS(afs_statfs) /* afs_vfsops.c */ \
542 AFS_CS(afs_sync) /* afs_vfsops.c */ \
543 AFS_CS(afs_vget) /* afs_vfsops.c */ \
544 AFS_CS(afs_mountroot) /* afs_vfsops.c */ \
545 AFS_CS(afs_swapvp) /* afs_vfsops.c */ \
546 AFS_CS(afs_AddMarinerName) /* afs_vnodeops.c */ \
547 AFS_CS(afs_setpag) /* afs_vnodeops.c */ \
548 AFS_CS(genpag) /* afs_vnodeops.c */ \
549 AFS_CS(getpag) /* afs_vnodeops.c */ \
550 AFS_CS(afs_GetMariner) /* afs_vnodeops.c */ \
551 AFS_CS(afs_badop) /* afs_vnodeops.c */ \
552 AFS_CS(afs_index) /* afs_vnodeops.c */ \
553 AFS_CS(afs_noop) /* afs_vnodeops.c */ \
554 AFS_CS(afs_open) /* afs_vnodeops.c */ \
555 AFS_CS(afs_closex) /* afs_vnodeops.c */ \
556 AFS_CS(afs_close) /* afs_vnodeops.c */ \
557 AFS_CS(afs_MemWrite) /* afs_vnodeops.c */ \
558 AFS_CS(afs_write) /* afs_vnodeops.c */ \
559 AFS_CS(afs_UFSWrite) /* afs_vnodeops.c */ \
560 AFS_CS(afs_rdwr) /* afs_vnodeops.c */ \
561 AFS_CS(afs_MemRead) /* afs_vnodeops.c */ \
562 AFS_CS(afs_read) /* afs_vnodeops.c */ \
563 AFS_CS(FIXUPSTUPIDINODE) /* afs_vnodeops.c */ \
564 AFS_CS(afs_UFSRead) /* afs_vnodeops.c */ \
565 AFS_CS(afs_CopyOutAttrs) /* afs_vnodeops.c */ \
566 AFS_CS(afs_getattr) /* afs_vnodeops.c */ \
567 AFS_CS(afs_VAttrToAS) /* afs_vnodeops.c */ \
568 AFS_CS(afs_setattr) /* afs_vnodeops.c */ \
569 AFS_CS(EvalMountPoint) /* afs_vnodeops.c */ \
570 AFS_CS(afs_access) /* afs_vnodeops.c */ \
571 AFS_CS(ENameOK) /* afs_vnodeops.c */ \
572 AFS_CS(HandleAtName) /* afs_vnodeops.c */ \
573 AFS_CS(getsysname) /* afs_vnodeops.c */ \
574 AFS_CS(strcat) /* afs_vnodeops.c */ \
575 AFS_CS(afs_lookup) /* afs_vnodeops.c */ \
576 AFS_CS(afs_create) /* afs_vnodeops.c */ \
577 AFS_CS(afs_LocalHero) /* afs_vnodeops.c */ \
578 AFS_CS(FetchWholeEnchilada) /* afs_vnodeops.c */ \
579 AFS_CS(afs_remove) /* afs_vnodeops.c */ \
580 AFS_CS(afs_link) /* afs_vnodeops.c */ \
581 AFS_CS(afs_rename) /* afs_vnodeops.c */ \
582 AFS_CS(afs_InitReq) /* afs_vnodeops.c */ \
583 AFS_CS(afs_mkdir) /* afs_vnodeops.c */ \
584 AFS_CS(BlobScan) /* afs_vnodeops.c */ \
585 AFS_CS(afs_rmdir) /* afs_vnodeops.c */ \
586 AFS_CS(RecLen) /* afs_vnodeops.c */ \
587 AFS_CS(RoundToInt) /* afs_vnodeops.c */ \
588 AFS_CS(afs_readdir_with_offlist) /* afs_vnodeops.c */ \
589 AFS_CS(DIRSIZ_LEN) /* afs_vnodeops.c */ \
590 AFS_CS(afs_readdir_move) /* afs_vnodeops.c */ \
591 AFS_CS(afs_readdir_iter) /* afs_vnodeops.c */ \
592 AFS_CS(HandleFlock) /* afs_vnodeops.c */ \
593 AFS_CS(afs_readdir) /* afs_vnodeops.c */ \
594 AFS_CS(afs_symlink) /* afs_vnodeops.c */ \
595 AFS_CS(afs_HandleLink) /* afs_vnodeops.c */ \
596 AFS_CS(afs_MemHandleLink) /* afs_vnodeops.c */ \
597 AFS_CS(afs_UFSHandleLink) /* afs_vnodeops.c */ \
598 AFS_CS(afs_readlink) /* afs_vnodeops.c */ \
599 AFS_CS(afs_fsync) /* afs_vnodeops.c */ \
600 AFS_CS(afs_inactive) /* afs_vnodeops.c */ \
601 AFS_CS(afs_ustrategy) /* afs_vnodeops.c */ \
602 AFS_CS(afs_bread) /* afs_vnodeops.c */ \
603 AFS_CS(afs_brelse) /* afs_vnodeops.c */ \
604 AFS_CS(afs_bmap) /* afs_vnodeops.c */ \
605 AFS_CS(afs_fid) /* afs_vnodeops.c */ \
606 AFS_CS(afs_strategy) /* afs_vnodeops.c */ \
607 AFS_CS(afs_FakeClose) /* afs_vnodeops.c */ \
608 AFS_CS(afs_FakeOpen) /* afs_vnodeops.c */ \
609 AFS_CS(afs_StoreOnLastReference) /* afs_vnodeops.c */ \
610 AFS_CS(afs_GetAccessBits) /* afs_vnodeops.c */ \
611 AFS_CS(afs_AccessOK) /* afs_vnodeops.c */ \
612 AFS_CS(shutdown_vnodeops) /* afs_vnodeops.c */ \
613 AFS_CS(afsio_copy) /* afs_vnodeops.c */ \
614 AFS_CS(afsio_trim) /* afs_vnodeops.c */ \
615 AFS_CS(afs_page_read) /* afs_vnodeops.c */ \
616 AFS_CS(afs_page_write) /* afs_vnodeops.c */ \
617 AFS_CS(afsio_skip) /* afs_vnodeops.c */ \
618 AFS_CS(afs_read1dir) /* afs_vnodeops.c */ \
619 AFS_CS(afs_get_groups_from_pag) /* afs_vnodeops.c */ \
620 AFS_CS(afs_get_pag_from_groups) /* afs_vnodeops.c */ \
621 AFS_CS(PagInCred) /* afs_vnodeops.c */ \
622 AFS_CS(afs_getgroups) /* afs_vnodeops.c */ \
623 AFS_CS(setpag) /* afs_vnodeops.c */ \
624 AFS_CS(afs_setgroups) /* afs_vnodeops.c */ \
625 AFS_CS(afs_page_in) /* afs_vnodeops.c */ \
626 AFS_CS(afs_page_out) /* afs_vnodeops.c */ \
627 AFS_CS(AddPag) /* afs_vnodeops.c */ \
628 AFS_CS(afs_AdvanceFD) /* afs_vnodeops.c */ \
629 AFS_CS(afs_lockf) /* afs_vnodeops.c */ \
630 AFS_CS(afs_xsetgroups) /* afs_vnodeops.c */ \
631 AFS_CS(afs_nlinks) /* afs_vnodeops.c */ \
632 AFS_CS(DoLockWarning) /* afs_vnodeops.c */ \
633 AFS_CS(afs_lockctl) /* afs_vnodeops.c */ \
634 AFS_CS(afs_xflock) /* afs_vnodeops.c */ \
635 AFS_CS(PSetSPrefs) /* afs_pioctl.c */ \
636 AFS_CS(PGetSPrefs) /* afs_pioctl.c */ \
637 AFS_CS(afs_warn) /* afs_warn.c */ \
638 AFS_CS(afs_warnuser) /* afs_warn.c */ \
639 AFS_CS(afs_pagein) /* afs_hp_subr.c */ \
640 AFS_CS(afs_pageout) /* afs_hp_subr.c */ \
641 AFS_CS(afs_hp_strategy) /* afs_hp_subr.c */ \
642 AFS_CS(PGetCPrefs) /* afs_pioctl.c */ \
643 AFS_CS(PSetCPrefs) /* afs_pioctl.c */ \
644 AFS_CS(SRXAFSCB_WhoAreYou) /* afs_callback.c */ \
645 AFS_CS(afs_DiscardDCache) /* afs_dcache.c */ \
646 AFS_CS(afs_FreeDiscardedDCache) /* afs_dcache.c */ \
647 AFS_CS(afs_MaybeFreeDiscardedDCache) /* afs_dcache.c */ \
648 AFS_CS(PFlushMount) /* afs_pioctl.c */ \
649 AFS_CS(SRXAFSCB_GetServerPrefs) /* afs_callback.c */ \
650 AFS_CS(SRXAFSCB_GetCellServDB) /* afs_callback.c */ \
651 AFS_CS(SRXAFSCB_GetLocalCell) /* afs_callback.c */ \
652 AFS_CS(afs_MarshallCacheConfig) /* afs_callback.c */ \
653 AFS_CS(SRXAFSCB_GetCacheConfig) /* afs_callback.c */ \
654 AFS_CS(SRXAFSCB_GetCE64) /* afs_callback.c */ \
655 AFS_CS(SRXAFSCB_GetCellByNum) /* afs_callback.c */ \
656 AFS_CS(BPrefetchNoCache) /* afs_daemons.c */ \
657 AFS_CS(afs_ReadNoCache) /* osi_vnodeops.c */ \
658 AFS_CS(PSetTokens2) /* afs_pioctl.c */ \
659 AFS_CS(PPrefetchFromTape) /* afs_pioctl.c */ \
660 AFS_CS(PFlushAllVolumeData) /* afs_pioctl.c */ \
661 AFS_CS(afs_InitVolSlot) /* afs_volume.c */ \
662 AFS_CS(afs_SetupVolSlot) /* afs_volume.c */
664 struct afs_CMCallStats
{
665 #define AFS_CS(call) afs_int32 C_ ## call;
670 struct afs_CMMeanStats
{
671 struct afs_MeanStats something
; /* fill this in */
675 struct afs_CMCallStats callInfo
;
676 struct afs_CMMeanStats meanInfo
;
680 * This is the structure accessible by specifying the
681 * AFSCB_XSTATSCOLL_CALL_INFO collection to the xstat package.
683 extern struct afs_CMStats afs_cmstats
;
686 * Constants to track downtime durations:
687 * Bucket 0: dur <= 10 min
688 * Bucket 1: 10 min < dur <= 30 min
689 * Bucket 2: 30 min < dur <= 1 hour
690 * Bucket 3: 1 hour < dur <= 2 hours
691 * Bucket 4: 2 hours < dur <= 4 hours
692 * Bucket 5: 4 hours < dur <= 8 hours
693 * Bucket 6: dur >= 8 hours
695 #define AFS_STATS_NUM_DOWNTIME_DURATION_BUCKETS 7
697 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET0 600 /*10 minutes */
698 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET1 1800 /*30 minutes */
699 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET2 3600 /*60 minutes */
700 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET3 7200 /*2 hours */
701 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET4 14400 /*4 hours */
702 #define AFS_STATS_MAX_DOWNTIME_DURATION_BUCKET5 28800 /*8 hours */
705 * Constants to track downtime incidents:
706 * Bucket 0: down = 0 times
707 * Bucket 1: down = 1 time
708 * Bucket 2: 1 time < down <= 5 times
709 * Bucket 3: 5 times < down <= 10 times
710 * Bucket 4: 10 times < down <= 50 times
711 * Bucket 5: down > 50 times
713 #define AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS 6
715 #define AFS_STATS_MAX_DOWNTIME_INCIDENTS_BUCKET0 0
716 #define AFS_STATS_MAX_DOWNTIME_INCIDENTS_BUCKET1 1
717 #define AFS_STATS_MAX_DOWNTIME_INCIDENTS_BUCKET2 5
718 #define AFS_STATS_MAX_DOWNTIME_INCIDENTS_BUCKET3 10
719 #define AFS_STATS_MAX_DOWNTIME_INCIDENTS_BUCKET4 50
722 * Numbers used to track aggregate up/downtime stats for servers. We'll
723 * keep these numbers separately for FS and VL server records, and then
724 * again separately for servers in the same cell as this client machine
725 * and those outside the client's cell.
727 struct afs_stats_SrvUpDownInfo
{
728 afs_int32 numTtlRecords
; /*# records, active or inactive */
729 afs_int32 numUpRecords
; /*# (active) records currently marked up */
730 afs_int32 numDownRecords
; /*# (active) records currently marked down */
731 afs_int32 sumOfRecordAges
; /*Sum of server record lifetimes */
732 afs_int32 ageOfYoungestRecord
; /*Age of youngest server record */
733 afs_int32 ageOfOldestRecord
; /*Age of oldest server record */
734 afs_int32 numDowntimeIncidents
; /*Number of (completed) downtime incidents */
735 afs_int32 numRecordsNeverDown
; /*Number of server records never marked down */
736 afs_int32 maxDowntimesInARecord
; /*Max downtimes seen by any record */
737 afs_int32 sumOfDowntimes
; /*Sum of all (completed) downtimes, in seconds */
738 afs_int32 shortestDowntime
; /*Shortest downtime, in seconds */
739 afs_int32 longestDowntime
; /*Longest downtime, in seconds */
741 * Arrays keeping distributions on downtime durations and number of
742 * downtime incidents.
744 afs_int32 downDurations
[AFS_STATS_NUM_DOWNTIME_DURATION_BUCKETS
];
745 afs_int32 downIncidents
[AFS_STATS_NUM_DOWNTIME_INCIDENTS_BUCKETS
];
749 * Define indices for the server up/downtime arrays below.
751 #define AFS_STATS_UPDOWN_IDX_SAME_CELL 0
752 #define AFS_STATS_UPDOWN_IDX_DIFF_CELL 1
755 * Performance numbers for the Cache Manager.
757 struct afs_stats_CMPerf
{
758 afs_int32 numPerfCalls
; /*# of performance calls rcvd */
760 afs_int32 epoch
; /*Cache Manager epoch time */
761 afs_int32 numCellsVisible
; /*# cells we know about */
762 afs_int32 numCellsContacted
; /*# cells corresponded with */
763 afs_int32 dlocalAccesses
; /*# data accesses to files within cell */
764 afs_int32 vlocalAccesses
; /*# stat accesses to files within cell */
765 afs_int32 dremoteAccesses
; /*# data accesses to files outside of cell */
766 afs_int32 vremoteAccesses
; /*# stat accesses to files outside of cell */
767 afs_int32 cacheNumEntries
; /*# cache entries */
768 afs_int32 cacheBlocksTotal
; /*# (1K) blocks configured for cache */
769 afs_int32 cacheBlocksInUse
; /*# cache blocks actively in use */
770 afs_int32 cacheBlocksOrig
; /*# cache blocks at bootup */
771 afs_int32 cacheMaxDirtyChunks
; /*Max # dirty cache chunks tolerated */
772 afs_int32 cacheCurrDirtyChunks
; /*Current # dirty cache chunks */
773 afs_int32 dcacheHits
; /*# data files found in local cache */
774 afs_int32 vcacheHits
; /*# stat entries found in local cache */
775 afs_int32 dcacheMisses
; /*# data files NOT found in local cache */
776 afs_int32 vcacheMisses
; /*# stat entries NOT found in local cache */
777 afs_int32 cacheFlushes
; /*# files flushed from cache */
778 afs_int32 cacheFilesReused
; /*# cache files reused */
779 afs_int32 ProtServerAddr
; /*Addr of Protection Server used */
780 afs_int32 vcacheXAllocs
; /* Additionally allocated vcaches */
781 afs_int32 dcacheXAllocs
; /* Additionally allocated dcaches */
784 * Some stats related to our buffer package
786 afs_int32 bufAlloced
; /* # of buffers allocated by afs */
787 afs_int32 bufHits
; /* # of pages found on buffer cache */
788 afs_int32 bufMisses
; /* # of pages NOT found on buffer cache */
789 afs_int32 bufFlushDirty
; /* # of cached dirty bufs flushed because all busy */
792 * Stats that keep track of all allocated/used objects in CM
794 afs_int32 LargeBlocksActive
; /* # of currently used large free pool entries */
795 afs_int32 LargeBlocksAlloced
; /* # of allocated large free pool entries */
796 afs_int32 SmallBlocksActive
; /* # of currently used small free pool entries */
797 afs_int32 SmallBlocksAlloced
; /* # of allocated used small free pool entries */
798 afs_int32 MediumBlocksActive
; /* # of currently used medium free pool entries */
799 afs_int32 MediumBlocksAlloced
; /* # of allocated used medium free pool entries */
800 afs_int32 OutStandingMemUsage
; /* # of alloced memory */
801 afs_int32 OutStandingAllocs
; /* Outstanding osi_allocs (no osi_frees yet) */
802 afs_int32 CallBackAlloced
; /* # callback structures allocated */
803 afs_int32 CallBackFlushes
; /* # callback flush operations performed */
806 * Accounting stats having to do with the server table & records.
808 afs_int32 srvRecords
; /*# of servers currently on record */
809 afs_int32 srvRecordsHWM
; /* Server record high water mark */
810 afs_int32 srvNumBuckets
; /* Num server hash chain buckets */
811 afs_int32 srvMaxChainLength
; /* Max server hash chain length */
812 afs_int32 srvMaxChainLengthHWM
; /* Server hash chain high water mark */
815 * Stats having to do with the systype upon which the Cache Manager
818 afs_int32 sysName_ID
; /*Sysname ID for host hardware */
821 * Stats recording downtime characteristics for each File Server and Volume
822 * Location Server we've dealt with, both within the same cell and in
825 struct afs_stats_SrvUpDownInfo fs_UpDown
[2];
826 struct afs_stats_SrvUpDownInfo vl_UpDown
[2];
829 afs_uint32 osiread_efaults
;
830 afs_int32 cacheBlocksDiscarded
; /*# cache blocks free but not truncated */
831 afs_int32 cacheBucket0_Discarded
;
832 afs_int32 cacheBucket1_Discarded
;
833 afs_int32 cacheBucket2_Discarded
;
836 * Spares for future expansion.
838 afs_int32 spare
[10]; /*Spares */
843 * Values denoting the File Server and Cache Manager opcodes.
845 #define AFS_STATS_FS_RPCIDX_FETCHDATA 0
846 #define AFS_STATS_FS_RPCIDX_FETCHACL 1
847 #define AFS_STATS_FS_RPCIDX_FETCHSTATUS 2
848 #define AFS_STATS_FS_RPCIDX_STOREDATA 3
849 #define AFS_STATS_FS_RPCIDX_STOREACL 4
850 #define AFS_STATS_FS_RPCIDX_STORESTATUS 5
851 #define AFS_STATS_FS_RPCIDX_REMOVEFILE 6
852 #define AFS_STATS_FS_RPCIDX_CREATEFILE 7
853 #define AFS_STATS_FS_RPCIDX_RENAME 8
854 #define AFS_STATS_FS_RPCIDX_SYMLINK 9
855 #define AFS_STATS_FS_RPCIDX_LINK 10
856 #define AFS_STATS_FS_RPCIDX_MAKEDIR 11
857 #define AFS_STATS_FS_RPCIDX_REMOVEDIR 12
858 #define AFS_STATS_FS_RPCIDX_SETLOCK 13
859 #define AFS_STATS_FS_RPCIDX_EXTENDLOCK 14
860 #define AFS_STATS_FS_RPCIDX_RELEASELOCK 15
861 #define AFS_STATS_FS_RPCIDX_GETSTATISTICS 16
862 #define AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS 17
863 #define AFS_STATS_FS_RPCIDX_GETVOLUMEINFO 18
864 #define AFS_STATS_FS_RPCIDX_GETVOLUMESTATUS 19
865 #define AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS 20
866 #define AFS_STATS_FS_RPCIDX_GETROOTVOLUME 21
867 #define AFS_STATS_FS_RPCIDX_CHECKTOKEN 22
868 #define AFS_STATS_FS_RPCIDX_GETTIME 23
869 #define AFS_STATS_FS_RPCIDX_NGETVOLUMEINFO 24
870 #define AFS_STATS_FS_RPCIDX_BULKSTATUS 25
871 #define AFS_STATS_FS_RPCIDX_XSTATSVERSION 26
872 #define AFS_STATS_FS_RPCIDX_GETXSTATS 27
873 #define AFS_STATS_FS_RPCIDX_XLOOKUP 28
874 #define AFS_STATS_FS_RPCIDX_RESIDENCYRPCS 29
876 #define AFS_STATS_NUM_FS_RPC_OPS 30
878 #define AFS_STATS_FS_RPCIDXES_ISWRITE(X) (((X > AFS_STATS_FS_RPCIDX_FETCHSTATUS) && (X < AFS_STATS_FS_RPCIDX_GETSTATISTICS)) || (X == AFS_STATS_FS_RPCIDX_SETVOLUMESTATUS))
879 #define AFS_STATS_FS_RPCIDXES_WRITE_RETRIABLE(X) ((X >= AFS_STATS_FS_RPCIDX_STOREDATA) && (X <= AFS_STATS_FS_RPCIDX_STORESTATUS))
881 #define AFS_STATS_FS_XFERIDX_FETCHDATA 0
882 #define AFS_STATS_FS_XFERIDX_STOREDATA 1
884 #define AFS_STATS_NUM_FS_XFER_OPS 2
886 #define AFS_STATS_CM_RPCIDX_CALLBACK 0
887 #define AFS_STATS_CM_RPCIDX_INITCALLBACKSTATE 1
888 #define AFS_STATS_CM_RPCIDX_PROBE 2
889 #define AFS_STATS_CM_RPCIDX_GETLOCK 3
890 #define AFS_STATS_CM_RPCIDX_GETCE 4
891 #define AFS_STATS_CM_RPCIDX_XSTATSVERSION 5
892 #define AFS_STATS_CM_RPCIDX_GETXSTATS 6
894 #define AFS_STATS_NUM_CM_RPC_OPS 7
898 * Record to track timing numbers for each Cache Manager RPC operation.
900 struct afs_stats_opTimingData
{
901 afs_int32 numOps
; /*Number of operations executed */
902 afs_int32 numSuccesses
; /*Number of successful ops */
903 osi_timeval32_t sumTime
; /*Sum of sample timings */
904 osi_timeval32_t sqrTime
; /*Sum of squares of sample timings */
905 osi_timeval32_t minTime
; /*Minimum timing value observed */
906 osi_timeval32_t maxTime
; /*Minimum timing value observed */
910 * We discriminate byte size transfers into this many buckets.
912 #define AFS_STATS_NUM_XFER_BUCKETS 9
914 #define AFS_STATS_MAXBYTES_BUCKET0 128
915 #define AFS_STATS_MAXBYTES_BUCKET1 1024
916 #define AFS_STATS_MAXBYTES_BUCKET2 8192
917 #define AFS_STATS_MAXBYTES_BUCKET3 16384
918 #define AFS_STATS_MAXBYTES_BUCKET4 32768
919 #define AFS_STATS_MAXBYTES_BUCKET5 131072
920 #define AFS_STATS_MAXBYTES_BUCKET6 524288
921 #define AFS_STATS_MAXBYTES_BUCKET7 1048576
924 * Record to track timings and byte sizes for data transfers.
926 struct afs_stats_xferData
{
927 afs_int32 numXfers
; /*Number of successful xfers */
928 afs_int32 numSuccesses
; /*Number of successful xfers */
929 osi_timeval32_t sumTime
; /*Sum of timing values */
930 osi_timeval32_t sqrTime
; /*Sum of squares of timing values */
931 osi_timeval32_t minTime
; /*Minimum xfer time recorded */
932 osi_timeval32_t maxTime
; /*Maximum xfer time recorded */
933 afs_int32 sumBytes
; /*Sum of KBytes transferred */
934 afs_int32 minBytes
; /*Minimum value observed */
935 afs_int32 maxBytes
; /*Maximum value observed */
936 afs_int32 count
[AFS_STATS_NUM_XFER_BUCKETS
]; /*Tally for each range of bytes */
940 * Macros to operate on time values.
942 * afs_stats_TimeLessThan(t1, t2) Non-zero if t1 is less than t2
943 * afs_stats_TimeGreaterThan(t1, t2) Non-zero if t1 is greater than t2
944 * afs_stats_GetDiff(t3, t1, t2) Set t3 to the difference between
945 * t1 and t2 (t1 is less than or
947 * afs_stats_AddTo(t1, t2) Add t2 to t1
948 * afs_stats_TimeAssign(t1, t2) Assign time t2 to t1
949 * afs_stats_SquareAddTo(t1,t2) Add square of t2 to t1
951 #define afs_stats_TimeLessThan(t1, t2) \
952 ((t1.tv_sec < t2.tv_sec) ? 1 : \
953 (t1.tv_sec > t2.tv_sec) ? 0 : \
954 (t1.tv_usec < t2.tv_usec) ? 1 : \
957 #define afs_stats_TimeGreaterThan(t1, t2) \
958 ((t1.tv_sec > t2.tv_sec) ? 1 : \
959 (t1.tv_sec < t2.tv_sec) ? 0 : \
960 (t1.tv_usec > t2.tv_usec) ? 1 : \
963 #define afs_stats_GetDiff(t3, t1, t2) \
966 * If the microseconds of the later time are smaller than \
967 * the earlier time, set up for proper subtraction (doing \
970 if (t2.tv_usec < t1.tv_usec) { \
971 t2.tv_usec += 1000000; \
974 t3.tv_sec = t2.tv_sec - t1.tv_sec; \
975 t3.tv_usec = t2.tv_usec - t1.tv_usec; \
978 #define afs_stats_AddTo(t1, t2) \
980 t1.tv_sec += t2.tv_sec; \
981 t1.tv_usec += t2.tv_usec; \
982 if (t1.tv_usec > 1000000) { \
983 t1.tv_usec -= 1000000; \
988 #define afs_stats_TimeAssign(t1, t2) \
990 t1.tv_sec = t2.tv_sec; \
991 t1.tv_usec = t2.tv_usec; \
994 * We calculate the square of a timeval as follows:
996 * The timeval struct contains two ints - the number of seconds and the
997 * number of microseconds. These two numbers together gives the correct
998 * amount of time => t = t.tv_sec + (t.tv_usec / 1000000);
1000 * if x = t.tv_sec and y = (t.tv_usec / 1000000) then the square is simply:
1004 * Since we are trying to avoid floating point math, we use the following
1005 * observations to simplify the above equation:
1007 * The resulting t.tv_sec (x') only depends upon the x^2 + 2xy portion
1008 * of the equation. This is easy to see if you think about y^2 in
1009 * decimal notation. y^2 is always < 0 since y < 0. Therefore in calculating
1010 * x', we can ignore y^2 (we do need to take care of rounding which is
1013 * Similarly, in calculating t.tv_usec (y') we can ignore x^2 and concentrate
1016 * You'll notice that both x' and y' depend upon 2xy. We can further
1017 * simplify things by realizing that x' depends on upon the integer
1018 * portion of the 2xy term. We can get part of this integer by
1019 * multiplying 2 * x * t.tv_usec and then truncating the result by
1020 * / 1000000. Similarly, we can get the decimal portion of this term
1021 * by performing the same multiplication and then % 1000000. It is
1022 * possible that the decimal portion will in fact contain some of the
1023 * integer portion (this will be taken care of when we ensure that y'
1024 * is less than 1000000).
1026 * The only other non-obvious calculation involves y^2. The key to
1027 * understanding this part of the calculation is to expand y again
1028 * in a nonobvious manner. We do this via the following expansion:
1030 * y = t.tv_usec / 1000000;
1031 * let abcdef represent the six digits of t.tv_usec then we have:
1032 * t.tv_usec / 1000000 = abc/1000 + def/1000000;
1036 * y^2 = (abc/1000)^2 + 2 * (abc/1000) * (def/1000000) + (def/1000000)^2
1038 * Examining this equation yields the following observations:
1040 * The second term can be calculated by multiplying abc and def then
1041 * shifting the decimal correctly.
1043 * (def/1000000)^2 contributes only to rounding and we only round up
1046 * These two observations are the basis for the somewhat cryptic
1047 * calculation of usec^2 (i.e. they are the "tricks").
1050 #define afs_stats_SquareAddTo(t1, t2) \
1053 * We use some tricks here to avoid floating point arithmetic \
1055 if(t2.tv_sec > 0 ) \
1057 t1.tv_sec += t2.tv_sec * t2.tv_sec \
1058 + 2 * t2.tv_sec * t2.tv_usec /1000000; \
1059 t1.tv_usec += (2 * t2.tv_sec * t2.tv_usec) % 1000000 \
1060 + (t2.tv_usec / 1000)*(t2.tv_usec / 1000) \
1061 + 2 * (t2.tv_usec / 1000) * (t2.tv_usec % 1000) / 1000 \
1062 + (((t2.tv_usec % 1000) > 707) ? 1 : 0); \
1066 t1.tv_usec += (t2.tv_usec / 1000)*(t2.tv_usec / 1000) \
1067 + 2 * (t2.tv_usec / 1000) * (t2.tv_usec % 1000) / 1000 \
1068 + (((t2.tv_usec % 1000) > 707) ? 1 : 0); \
1070 if (t1.tv_usec > 1000000) { \
1071 t1.tv_usec -= 1000000; \
1080 * Structure recording RPC outcomes.
1082 struct afs_stats_RPCErrors
{
1083 afs_int32 err_Server
; /*Server down error */
1084 afs_int32 err_Network
; /*Network error */
1085 afs_int32 err_Protection
; /*Protection violation */
1086 afs_int32 err_Volume
; /*Volume-related error */
1087 afs_int32 err_VolumeBusies
; /*"Volume busy conditions encountered */
1088 afs_int32 err_Other
; /*Misc other errors */
1093 * Structure holding RPC interface opcode measurements for the Cache Manager.
1095 struct afs_stats_RPCOpInfo
{
1096 struct afs_stats_opTimingData
1097 fsRPCTimes
[AFS_STATS_NUM_FS_RPC_OPS
]; /*Individual FS RPC op timings */
1098 struct afs_stats_RPCErrors
1099 fsRPCErrors
[AFS_STATS_NUM_FS_RPC_OPS
]; /*Individual FS RPC op errors */
1100 struct afs_stats_xferData
1101 fsXferTimes
[AFS_STATS_NUM_FS_XFER_OPS
]; /*Individual FS RPC xfer timings */
1102 struct afs_stats_opTimingData
1103 cmRPCTimes
[AFS_STATS_NUM_CM_RPC_OPS
]; /*Individual CM RPC op timings */
1107 * Structure holding authentication info for the CM.
1109 struct afs_stats_AuthentInfo
{
1111 * This first set of fields don't have any history - they are simply
1112 * snapshots of the system at the time of the probe.
1114 afs_int32 curr_PAGs
; /*Current number of PAGs */
1115 afs_int32 curr_Records
; /*Current # of records in table */
1116 afs_int32 curr_AuthRecords
; /*Current # of authenticated
1117 * records (w/valid ticket) */
1118 afs_int32 curr_UnauthRecords
; /*Current # of unauthenticated
1119 * records (w/o any ticket at all) */
1120 afs_int32 curr_MaxRecordsInPAG
; /*Max records for a single PAG */
1121 afs_int32 curr_LongestChain
; /*Length of longest current hash chain */
1124 * This second set of fields are values accumulated over the lifetme
1125 * of the current CM incarnation.
1127 afs_int32 PAGCreations
; /*# PAG creations */
1128 afs_int32 TicketUpdates
; /*# ticket additions/refreshes */
1129 afs_int32 HWM_PAGs
; /*High water mark - # PAGs */
1130 afs_int32 HWM_Records
; /* " - # records */
1131 afs_int32 HWM_MaxRecordsInPAG
; /* " - max records for a single PAG */
1132 afs_int32 HWM_LongestChain
; /* " - longest hash chain */
1136 * [Un]replicated file access. These count the number of RXAFS_FetchData
1137 * calls get accomplished, and their need to call upon other replicas in
1140 struct afs_stats_AccessInfo
{
1141 afs_int32 unreplicatedRefs
; /*# references to unreplicated data */
1142 afs_int32 replicatedRefs
; /*# references to replicated data */
1143 afs_int32 numReplicasAccessed
; /*# replicas accessed */
1144 afs_int32 maxReplicasPerRef
; /*Max # replicas accessed per ref */
1145 afs_int32 refFirstReplicaOK
; /*# references satisfied by 1st replica */
1149 * Structure holding authoring info for the CM. We keep track of
1150 * the results of writes on files and directories independently.
1151 * Results cover all objects in the cache uniformly.
1153 struct afs_stats_AuthorInfo
{
1154 afs_int32 fileSameAuthor
; /*File write by same author */
1155 afs_int32 fileDiffAuthor
; /*File write by diff author */
1156 afs_int32 dirSameAuthor
; /*Directory write by same author */
1157 afs_int32 dirDiffAuthor
; /*Directory write by diff author */
1161 * Structure holding ``full'' CM peformance measurements.
1163 struct afs_stats_CMFullPerf
{
1164 afs_int32 numFullPerfCalls
; /*Number of accesses */
1165 struct afs_stats_CMPerf perf
; /*General performance stats */
1166 struct afs_stats_RPCOpInfo rpc
; /*RPC op stats */
1167 struct afs_stats_AuthentInfo authent
; /*Authentication stats */
1168 struct afs_stats_AccessInfo accessinf
; /*Access stats */
1169 struct afs_stats_AuthorInfo author
; /*Authorship stats */
1173 * These are the storage declarations for the structures accessible
1174 * via the xstat package.
1176 /* extern struct afs_stats_CMPerf afs_stats_cmperf; */
1177 /* extern struct afs_stats_CMFullPerf afs_stats_cmfullperf; */
1178 /* extern afs_int32 afs_stats_XferSumBytes[]; */
1182 * We define routines to keep running counts and means. For the
1183 * running count, we have to concatenate the ``C_'' prefix on to
1184 * the routine name passed in as an argument to get the right
1187 #define AFS_STATCNT(arg) ((afs_cmstats.callInfo.C_ ## arg)++)
1189 #define AFS_MEANCNT(arg, value) \
1190 (afs_AddToMean(((afs_cmstats.meanInfo).(arg)),value))
1192 #endif /* AFS_NOSTATS */
1195 #endif /* __OPENAFS_AFS_STATS_H__ */