Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /* |
2 | * Copyright 2000, International Business Machines Corporation and others. | |
3 | * All Rights Reserved. | |
4 | * | |
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 | |
8 | */ | |
9 | ||
10 | /* statistics-gathering package */ | |
11 | ||
12 | #include <afsconfig.h> | |
13 | #include "afs/param.h" | |
14 | ||
15 | ||
16 | #include "afs/sysincludes.h" /*Standard vendor system headers */ | |
17 | #include "afsincludes.h" /*AFS-based standard headers */ | |
18 | #include "afs_stats.h" | |
19 | ||
20 | struct afs_CMStats afs_cmstats; | |
21 | struct afs_stats_CMPerf afs_stats_cmperf; | |
22 | struct afs_stats_CMFullPerf afs_stats_cmfullperf; | |
23 | afs_int32 afs_stats_XferSumBytes[AFS_STATS_NUM_FS_XFER_OPS]; | |
24 | ||
25 | ||
26 | ||
27 | /* | |
28 | * afs_InitStats | |
29 | * | |
30 | * Description: | |
31 | * Initialize all of the CM statistics structures. | |
32 | * | |
33 | * Parameters: | |
34 | * None. | |
35 | * | |
36 | * Environment: | |
37 | * This routine should only be called once, at initialization time. | |
38 | */ | |
39 | void | |
40 | afs_InitStats(void) | |
41 | { | |
42 | struct afs_stats_opTimingData *opTimeP; /*Ptr to curr timing struct */ | |
43 | struct afs_stats_xferData *xferP; /*Ptr to curr xfer struct */ | |
44 | int currIdx; /*Current index */ | |
45 | ||
46 | /* | |
47 | * First step is to zero everything out. | |
48 | */ | |
49 | memset((&afs_cmstats), 0, sizeof(struct afs_CMStats)); | |
50 | memset((&afs_stats_cmperf), 0, sizeof(struct afs_stats_CMPerf)); | |
51 | memset((&afs_stats_cmfullperf), 0, | |
52 | sizeof(struct afs_stats_CMFullPerf)); | |
53 | ||
54 | /* | |
55 | * Some fields really should be non-zero at the start, so set 'em up. | |
56 | */ | |
57 | afs_stats_cmperf.srvNumBuckets = NSERVERS; | |
58 | ||
59 | opTimeP = &(afs_stats_cmfullperf.rpc.fsRPCTimes[0]); | |
60 | for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; | |
61 | currIdx++, opTimeP++) | |
62 | opTimeP->minTime.tv_sec = 999999; | |
63 | ||
64 | opTimeP = &(afs_stats_cmfullperf.rpc.cmRPCTimes[0]); | |
65 | for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; | |
66 | currIdx++, opTimeP++) | |
67 | opTimeP->minTime.tv_sec = 999999; | |
68 | ||
69 | xferP = &(afs_stats_cmfullperf.rpc.fsXferTimes[0]); | |
70 | for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++, xferP++) { | |
71 | xferP->minTime.tv_sec = 999999; | |
72 | xferP->minBytes = 999999999; | |
73 | } | |
74 | } | |
75 | ||
76 | void | |
77 | afs_GetCMStat(char **ptr, unsigned *size) | |
78 | { | |
79 | #ifndef AFS_NOSTATS | |
80 | AFS_STATCNT(afs_GetCMStat); | |
81 | *ptr = (char *)&afs_cmstats; | |
82 | *size = sizeof(afs_cmstats); | |
83 | #endif /* AFS_NOSTATS */ | |
84 | } | |
85 | ||
86 | void | |
87 | afs_AddToMean(struct afs_MeanStats *oldMean, afs_int32 newValue) | |
88 | { | |
89 | AFS_STATCNT(afs_AddToMean); | |
90 | } |