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
10 /* statistics-gathering package */
12 #include "../afs/param.h" /*Should be always first*/
13 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
14 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
15 #include "afs_stats.h"
17 struct afs_CMStats afs_cmstats;
18 struct afs_stats_CMPerf afs_stats_cmperf;
19 struct afs_stats_CMFullPerf afs_stats_cmfullperf;
20 afs_int32 afs_stats_XferSumBytes[AFS_STATS_NUM_FS_XFER_OPS];
28 * Initialize all of the CM statistics structures.
34 * This routine should only be called once, at initialization time.
40 struct afs_stats_opTimingData *opTimeP; /*Ptr to curr timing struct*/
41 struct afs_stats_xferData *xferP; /*Ptr to curr xfer struct*/
42 int currIdx; /*Current index*/
45 * First step is to zero everything out.
47 bzero((char *)(&afs_cmstats), sizeof(struct afs_CMStats));
48 bzero((char *)(&afs_stats_cmperf), sizeof(struct afs_stats_CMPerf));
49 bzero((char *)(&afs_stats_cmfullperf),
50 sizeof(struct afs_stats_CMFullPerf));
53 * Some fields really should be non-zero at the start, so set 'em up.
55 afs_stats_cmperf.srvNumBuckets = NSERVERS;
57 opTimeP = &(afs_stats_cmfullperf.rpc.fsRPCTimes[0]);
58 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++, opTimeP++)
59 opTimeP->minTime.tv_sec = 999999;
61 opTimeP = &(afs_stats_cmfullperf.rpc.cmRPCTimes[0]);
62 for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++, opTimeP++)
63 opTimeP->minTime.tv_sec = 999999;
65 xferP = &(afs_stats_cmfullperf.rpc.fsXferTimes[0]);
66 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++, xferP++) {
67 xferP->minTime.tv_sec = 999999;
68 xferP->minBytes = 999999999;
75 afs_GetCMStat(ptr, size)
76 char **ptr; /* memory area */
77 unsigned *size; /* # of bytes */
80 AFS_STATCNT(afs_GetCMStat);
81 *ptr = (char *)&afs_cmstats;
82 *size = sizeof(afs_cmstats);
83 #endif /* AFS_NOSTATS */
86 afs_AddToMean(oldMean, newValue)
87 struct afs_MeanStats *oldMean;
90 AFS_STATCNT(afs_AddToMean);