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 | /* | |
11 | * This program will parse the output generated by afsmonitor (with the -output | |
12 | * switch) and print it in a readable form. It does not make any statistical | |
13 | * analysis of the data. | |
14 | * | |
15 | * Most of the code here is cloned from afsmon-output.c. It is made as a | |
16 | * separate file so that it can be independently given to customers. | |
17 | * | |
18 | *-------------------------------------------------------------------------*/ | |
19 | ||
20 | #include <afsconfig.h> | |
21 | #include <afs/param.h> | |
22 | ||
23 | #include <stdio.h> | |
24 | ||
25 | ||
26 | #include <afs/xstat_fs.h> | |
27 | #include <afs/xstat_cm.h> | |
28 | #include <malloc.h> | |
29 | ||
30 | ||
31 | /* Number of items of CM & FS statistics collected per probe. | |
32 | These constants MUST be changed if the xstat structures are modified */ | |
33 | ||
34 | #define XSTAT_CM_FULLPERF_RESULTS_LEN 740 | |
35 | #define XSTAT_FS_FULLPERF_RESULTS_LEN 424 | |
36 | ||
37 | ||
38 | /* structures used by FS & CM stats print routines */ | |
39 | ||
40 | static char *fsOpNames[] = { | |
41 | "FetchData", | |
42 | "FetchACL", | |
43 | "FetchStatus", | |
44 | "StoreData", | |
45 | "StoreACL", | |
46 | "StoreStatus", | |
47 | "RemoveFile", | |
48 | "CreateFile", | |
49 | "Rename", | |
50 | "Symlink", | |
51 | "Link", | |
52 | "MakeDir", | |
53 | "RemoveDir", | |
54 | "SetLock", | |
55 | "ExtendLock", | |
56 | "ReleaseLock", | |
57 | "GetStatistics", | |
58 | "GiveUpCallbacks", | |
59 | "GetVolumeInfo", | |
60 | "GetVolumeStatus", | |
61 | "SetVolumeStatus", | |
62 | "GetRootVolume", | |
63 | "CheckToken", | |
64 | "GetTime", | |
65 | "NGetVolumeInfo", | |
66 | "BulkStatus", | |
67 | "XStatsVersion", | |
68 | "GetXStats" | |
69 | }; | |
70 | ||
71 | static char *cmOpNames[] = { | |
72 | "CallBack", | |
73 | "InitCallBackState", | |
74 | "Probe", | |
75 | "GetLock", | |
76 | "GetCE", | |
77 | "XStatsVersion", | |
78 | "GetXStats" | |
79 | }; | |
80 | ||
81 | static char *xferOpNames[] = { | |
82 | "FetchData", | |
83 | "StoreData" | |
84 | }; | |
85 | ||
86 | /*________________________________________________________________________ | |
87 | FS STATS ROUTINES | |
88 | *_______________________________________________________________________*/ | |
89 | ||
90 | /*------------------------------------------------------------------------ | |
91 | * Print_fs_OverallPerfInfo | |
92 | * | |
93 | * Description: | |
94 | * Print out overall performance numbers. | |
95 | * | |
96 | * Arguments: | |
97 | * a_ovP : Ptr to the overall performance numbers. | |
98 | * | |
99 | *------------------------------------------------------------------------*/ | |
100 | ||
101 | void | |
102 | Print_fs_OverallPerfInfo(a_ovP) | |
103 | struct afs_PerfStats *a_ovP; | |
104 | ||
105 | { /*Print_fs_OverallPerfInfo */ | |
106 | ||
107 | printf("\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls); | |
108 | ||
109 | ||
110 | /* | |
111 | * Vnode cache section. | |
112 | */ | |
113 | printf("\t%10d vcache_L_Entries\n", a_ovP->vcache_L_Entries); | |
114 | printf("\t%10d vcache_L_Allocs\n", a_ovP->vcache_L_Allocs); | |
115 | printf("\t%10d vcache_L_Gets\n", a_ovP->vcache_L_Gets); | |
116 | printf("\t%10d vcache_L_Reads\n", a_ovP->vcache_L_Reads); | |
117 | printf("\t%10d vcache_L_Writes\n\n", a_ovP->vcache_L_Writes); | |
118 | ||
119 | printf("\t%10d vcache_S_Entries\n", a_ovP->vcache_S_Entries); | |
120 | printf("\t%10d vcache_S_Allocs\n", a_ovP->vcache_S_Allocs); | |
121 | printf("\t%10d vcache_S_Gets\n", a_ovP->vcache_S_Gets); | |
122 | printf("\t%10d vcache_S_Reads\n", a_ovP->vcache_S_Reads); | |
123 | printf("\t%10d vcache_S_Writes\n\n", a_ovP->vcache_S_Writes); | |
124 | ||
125 | printf("\t%10d vcache_H_Entries\n", a_ovP->vcache_H_Entries); | |
126 | printf("\t%10d vcache_H_Gets\n", a_ovP->vcache_H_Gets); | |
127 | printf("\t%10d vcache_H_Replacements\n\n", a_ovP->vcache_H_Replacements); | |
128 | ||
129 | /* | |
130 | * Directory package section. | |
131 | */ | |
132 | printf("\t%10d dir_Buffers\n", a_ovP->dir_Buffers); | |
133 | printf("\t%10d dir_Calls\n", a_ovP->dir_Calls); | |
134 | printf("\t%10d dir_IOs\n\n", a_ovP->dir_IOs); | |
135 | ||
136 | /* | |
137 | * Rx section. | |
138 | */ | |
139 | printf("\t%10d rx_packetRequests\n", a_ovP->rx_packetRequests); | |
140 | printf("\t%10d rx_noPackets_RcvClass\n", a_ovP->rx_noPackets_RcvClass); | |
141 | printf("\t%10d rx_noPackets_SendClass\n", a_ovP->rx_noPackets_SendClass); | |
142 | printf("\t%10d rx_noPackets_SpecialClass\n", | |
143 | a_ovP->rx_noPackets_SpecialClass); | |
144 | printf("\t%10d rx_socketGreedy\n", a_ovP->rx_socketGreedy); | |
145 | printf("\t%10d rx_bogusPacketOnRead\n", a_ovP->rx_bogusPacketOnRead); | |
146 | printf("\t%10d rx_bogusHost\n", a_ovP->rx_bogusHost); | |
147 | printf("\t%10d rx_noPacketOnRead\n", a_ovP->rx_noPacketOnRead); | |
148 | printf("\t%10d rx_noPacketBuffersOnRead\n", | |
149 | a_ovP->rx_noPacketBuffersOnRead); | |
150 | printf("\t%10d rx_selects\n", a_ovP->rx_selects); | |
151 | printf("\t%10d rx_sendSelects\n", a_ovP->rx_sendSelects); | |
152 | printf("\t%10d rx_packetsRead_RcvClass\n", | |
153 | a_ovP->rx_packetsRead_RcvClass); | |
154 | printf("\t%10d rx_packetsRead_SendClass\n", | |
155 | a_ovP->rx_packetsRead_SendClass); | |
156 | printf("\t%10d rx_packetsRead_SpecialClass\n", | |
157 | a_ovP->rx_packetsRead_SpecialClass); | |
158 | printf("\t%10d rx_dataPacketsRead\n", a_ovP->rx_dataPacketsRead); | |
159 | printf("\t%10d rx_ackPacketsRead\n", a_ovP->rx_ackPacketsRead); | |
160 | printf("\t%10d rx_dupPacketsRead\n", a_ovP->rx_dupPacketsRead); | |
161 | printf("\t%10d rx_spuriousPacketsRead\n", a_ovP->rx_spuriousPacketsRead); | |
162 | printf("\t%10d rx_packetsSent_RcvClass\n", | |
163 | a_ovP->rx_packetsSent_RcvClass); | |
164 | printf("\t%10d rx_packetsSent_SendClass\n", | |
165 | a_ovP->rx_packetsSent_SendClass); | |
166 | printf("\t%10d rx_packetsSent_SpecialClass\n", | |
167 | a_ovP->rx_packetsSent_SpecialClass); | |
168 | printf("\t%10d rx_ackPacketsSent\n", a_ovP->rx_ackPacketsSent); | |
169 | printf("\t%10d rx_pingPacketsSent\n", a_ovP->rx_pingPacketsSent); | |
170 | printf("\t%10d rx_abortPacketsSent\n", a_ovP->rx_abortPacketsSent); | |
171 | printf("\t%10d rx_busyPacketsSent\n", a_ovP->rx_busyPacketsSent); | |
172 | printf("\t%10d rx_dataPacketsSent\n", a_ovP->rx_dataPacketsSent); | |
173 | printf("\t%10d rx_dataPacketsReSent\n", a_ovP->rx_dataPacketsReSent); | |
174 | printf("\t%10d rx_dataPacketsPushed\n", a_ovP->rx_dataPacketsPushed); | |
175 | printf("\t%10d rx_ignoreAckedPacket\n", a_ovP->rx_ignoreAckedPacket); | |
176 | printf("\t%10d rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec); | |
177 | printf("\t%10d rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec); | |
178 | printf("\t%10d rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec); | |
179 | printf("\t%10d rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec); | |
180 | printf("\t%10d rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec); | |
181 | printf("\t%10d rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec); | |
182 | printf("\t%10d rx_nRttSamples\n", a_ovP->rx_nRttSamples); | |
183 | printf("\t%10d rx_nServerConns\n", a_ovP->rx_nServerConns); | |
184 | printf("\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns); | |
185 | printf("\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs); | |
186 | printf("\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs); | |
187 | printf("\t%10d rx_nFreeCallStructs\n\n", a_ovP->rx_nFreeCallStructs); | |
188 | ||
189 | /* | |
190 | * Host module fields. | |
191 | */ | |
192 | printf("\t%10d host_NumHostEntries\n", a_ovP->host_NumHostEntries); | |
193 | printf("\t%10d host_HostBlocks\n", a_ovP->host_HostBlocks); | |
194 | printf("\t%10d host_NonDeletedHosts\n", a_ovP->host_NonDeletedHosts); | |
195 | printf("\t%10d host_HostsInSameNetOrSubnet\n", | |
196 | a_ovP->host_HostsInSameNetOrSubnet); | |
197 | printf("\t%10d host_HostsInDiffSubnet\n", a_ovP->host_HostsInDiffSubnet); | |
198 | printf("\t%10d host_HostsInDiffNetwork\n", | |
199 | a_ovP->host_HostsInDiffNetwork); | |
200 | printf("\t%10d host_NumClients\n", a_ovP->host_NumClients); | |
201 | printf("\t%10d host_ClientBlocks\n\n", a_ovP->host_ClientBlocks); | |
202 | ||
203 | } /*Print_fs_OverallPerfInfo */ | |
204 | ||
205 | ||
206 | /*------------------------------------------------------------------------ | |
207 | * Print_fs_OpTiming | |
208 | * | |
209 | * Description: | |
210 | * Print out the contents of an RPC op timing structure. | |
211 | * | |
212 | * Arguments: | |
213 | * a_opIdx : Index of the AFS operation we're printing number on. | |
214 | * a_opTimeP : Ptr to the op timing structure to print. | |
215 | * | |
216 | *------------------------------------------------------------------------*/ | |
217 | ||
218 | void | |
219 | Print_fs_OpTiming(a_opIdx, a_opTimeP) | |
220 | int a_opIdx; | |
221 | struct fs_stats_opTimingData *a_opTimeP; | |
222 | ||
223 | { /*Print_fs_OpTiming */ | |
224 | ||
225 | printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n", | |
226 | fsOpNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses, | |
227 | a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec, | |
228 | a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec, | |
229 | a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec); | |
230 | ||
231 | } /*Print_fs_OpTiming */ | |
232 | ||
233 | ||
234 | /*------------------------------------------------------------------------ | |
235 | * Print_fs_XferTiming | |
236 | * | |
237 | * Description: | |
238 | * Print out the contents of a data transfer structure. | |
239 | * | |
240 | * Arguments: | |
241 | * a_opIdx : Index of the AFS operation we're printing number on. | |
242 | * a_xferP : Ptr to the data transfer structure to print. | |
243 | * | |
244 | *------------------------------------------------------------------------*/ | |
245 | ||
246 | void | |
247 | Print_fs_XferTiming(a_opIdx, a_xferP) | |
248 | int a_opIdx; | |
249 | struct fs_stats_xferData *a_xferP; | |
250 | ||
251 | { /*Print_fs_XferTiming */ | |
252 | ||
253 | printf | |
254 | ("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n", | |
255 | xferOpNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses, | |
256 | a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec, | |
257 | a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec, | |
258 | a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec); | |
259 | printf("\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes, | |
260 | a_xferP->minBytes, a_xferP->maxBytes); | |
261 | printf | |
262 | ("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d 7:%d 8:%d]\n", | |
263 | a_xferP->count[0], a_xferP->count[1], a_xferP->count[2], | |
264 | a_xferP->count[3], a_xferP->count[4], a_xferP->count[5], | |
265 | a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]); | |
266 | ||
267 | } /*Print_fs_XferTiming */ | |
268 | ||
269 | ||
270 | /*------------------------------------------------------------------------ | |
271 | * Print_fs_DetailedPerfInfo | |
272 | * | |
273 | * Description: | |
274 | * Print out a set of detailed performance numbers. | |
275 | * | |
276 | * Arguments: | |
277 | * a_detP : Ptr to detailed perf numbers to print. | |
278 | * | |
279 | *------------------------------------------------------------------------*/ | |
280 | ||
281 | void | |
282 | Print_fs_DetailedPerfInfo(a_detP) | |
283 | struct fs_stats_DetailedStats *a_detP; | |
284 | ||
285 | { /*Print_fs_DetailedPerfInfo */ | |
286 | ||
287 | int currIdx; /*Loop variable */ | |
288 | ||
289 | printf("\t%10d epoch\n", a_detP->epoch); | |
290 | ||
291 | for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++) | |
292 | Print_fs_OpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx])); | |
293 | ||
294 | for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++) | |
295 | Print_fs_XferTiming(currIdx, &(a_detP->xferOpTimes[currIdx])); | |
296 | ||
297 | } /*Print_fs_DetailedPerfInfo */ | |
298 | ||
299 | ||
300 | /*------------------------------------------------------------------------ | |
301 | * Print_fs_FullPerfInfo | |
302 | * | |
303 | * Description: | |
304 | * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just | |
305 | * received. | |
306 | * | |
307 | * Arguments: | |
308 | * None. | |
309 | * | |
310 | *------------------------------------------------------------------------*/ | |
311 | ||
312 | void | |
313 | Print_fs_FullPerfInfo(a_fs_Results) | |
314 | struct xstat_fs_ProbeResults *a_fs_Results; /* ptr to fs results */ | |
315 | { /*Print_fs_FullPerfInfo */ | |
316 | ||
317 | static char rn[] = "Print_fs_FullPerfInfo"; /*Routine name */ | |
318 | static long fullPerfLongs = (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # longs to rcv */ | |
319 | long numLongs; /*# longwords received */ | |
320 | struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */ | |
321 | struct fs_stats_FullPerfStats buffer; | |
322 | char *printableTime; /*Ptr to printable time string */ | |
323 | time_t probeTime; | |
324 | int code; | |
325 | ||
326 | code = xstat_fs_DecodeFullPerfStats(&fullPerfP, | |
327 | a_fs_Results->data.AFS_CollData_val, | |
328 | a_fs_Results->data.AFS_CollData_len, | |
329 | &buffer); | |
330 | if (code) { | |
331 | numLongs = a_fs_Results->data.AFS_CollData_len; | |
332 | printf(" ** Data size mismatch in full performance collection!\n"); | |
333 | printf(" ** Expecting %d, got %d\n", fullPerfLongs, numLongs); | |
334 | return; | |
335 | } | |
336 | ||
337 | probeTime = a_fs_Results->probeTime; | |
338 | printableTime = ctime(&probeTime); | |
339 | printableTime[strlen(printableTime) - 1] = '\0'; | |
340 | ||
341 | printf | |
342 | ("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n", | |
343 | a_fs_Results->collectionNumber, a_fs_Results->connP->hostName, | |
344 | a_fs_Results->probeNum, printableTime); | |
345 | ||
346 | Print_fs_OverallPerfInfo(&(fullPerfP->overall)); | |
347 | Print_fs_DetailedPerfInfo(&(fullPerfP->det)); | |
348 | ||
349 | } /*Print_fs_FullPerfInfo */ | |
350 | ||
351 | ||
352 | ||
353 | /*___________________________________________________________________________ | |
354 | CM STATS | |
355 | *__________________________________________________________________________*/ | |
356 | ||
357 | ||
358 | ||
359 | /*------------------------------------------------------------------------ | |
360 | * Print_cm_UpDownStats | |
361 | * | |
362 | * Description: | |
363 | * Print the up/downtime stats for the given class of server records | |
364 | * provided. | |
365 | * | |
366 | * Arguments: | |
367 | * a_upDownP : Ptr to the server up/down info. | |
368 | * | |
369 | *------------------------------------------------------------------------*/ | |
370 | ||
371 | void | |
372 | Print_cm_UpDownStats(a_upDownP) | |
373 | struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */ | |
374 | ||
375 | { /*Print_cm_UpDownStats */ | |
376 | ||
377 | /* | |
378 | * First, print the simple values. | |
379 | */ | |
380 | printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords); | |
381 | printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords); | |
382 | printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords); | |
383 | printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges); | |
384 | printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord); | |
385 | printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord); | |
386 | printf("\t\t%10d numDowntimeIncidents\n", | |
387 | a_upDownP->numDowntimeIncidents); | |
388 | printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown); | |
389 | printf("\t\t%10d maxDowntimesInARecord\n", | |
390 | a_upDownP->maxDowntimesInARecord); | |
391 | printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes); | |
392 | printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime); | |
393 | printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime); | |
394 | ||
395 | /* | |
396 | * Now, print the array values. | |
397 | */ | |
398 | printf("\t\tDowntime duration distribution:\n"); | |
399 | printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]); | |
400 | printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]); | |
401 | printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]); | |
402 | printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]); | |
403 | printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]); | |
404 | printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]); | |
405 | printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]); | |
406 | ||
407 | printf("\t\tDowntime incident distribution:\n"); | |
408 | printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]); | |
409 | printf("\t\t\t%8d: 1 time\n", a_upDownP->downIncidents[1]); | |
410 | printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downIncidents[2]); | |
411 | printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downIncidents[3]); | |
412 | printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downIncidents[4]); | |
413 | printf("\t\t\t%8d: > 50 times\n", a_upDownP->downIncidents[5]); | |
414 | ||
415 | } /*Print_cm_UpDownStats */ | |
416 | ||
417 | ||
418 | /*------------------------------------------------------------------------ | |
419 | * Print_cm_OverallPerfInfo | |
420 | * | |
421 | * Description: | |
422 | * Print out overall performance numbers. | |
423 | * | |
424 | * Arguments: | |
425 | * a_ovP : Ptr to the overall performance numbers. | |
426 | * | |
427 | *------------------------------------------------------------------------*/ | |
428 | ||
429 | void | |
430 | Print_cm_OverallPerfInfo(a_ovP) | |
431 | struct afs_stats_CMPerf *a_ovP; | |
432 | ||
433 | { /*Print_cm_OverallPerfInfo */ | |
434 | ||
435 | printf("\t%10d numPerfCalls\n", a_ovP->numPerfCalls); | |
436 | ||
437 | printf("\t%10d epoch\n", a_ovP->epoch); | |
438 | printf("\t%10d numCellsVisible\n", a_ovP->numCellsVisible); | |
439 | printf("\t%10d numCellsContacted\n", a_ovP->numCellsContacted); | |
440 | printf("\t%10d dlocalAccesses\n", a_ovP->dlocalAccesses); | |
441 | printf("\t%10d vlocalAccesses\n", a_ovP->vlocalAccesses); | |
442 | printf("\t%10d dremoteAccesses\n", a_ovP->dremoteAccesses); | |
443 | printf("\t%10d vremoteAccesses\n", a_ovP->vremoteAccesses); | |
444 | printf("\t%10d cacheNumEntries\n", a_ovP->cacheNumEntries); | |
445 | printf("\t%10d cacheBlocksTotal\n", a_ovP->cacheBlocksTotal); | |
446 | printf("\t%10d cacheBlocksInUse\n", a_ovP->cacheBlocksInUse); | |
447 | printf("\t%10d cacheBlocksOrig\n", a_ovP->cacheBlocksOrig); | |
448 | printf("\t%10d cacheMaxDirtyChunks\n", a_ovP->cacheMaxDirtyChunks); | |
449 | printf("\t%10d cacheCurrDirtyChunks\n", a_ovP->cacheCurrDirtyChunks); | |
450 | printf("\t%10d dcacheHits\n", a_ovP->dcacheHits); | |
451 | printf("\t%10d vcacheHits\n", a_ovP->vcacheHits); | |
452 | printf("\t%10d dcacheMisses\n", a_ovP->dcacheMisses); | |
453 | printf("\t%10d vcacheMisses\n", a_ovP->vcacheMisses); | |
454 | printf("\t%10d cacheFilesReused\n", a_ovP->cacheFilesReused); | |
455 | printf("\t%10d vcacheXAllocs\n", a_ovP->vcacheXAllocs); | |
456 | ||
457 | printf("\t%10d bufAlloced\n", a_ovP->bufAlloced); | |
458 | printf("\t%10d bufHits\n", a_ovP->bufHits); | |
459 | printf("\t%10d bufMisses\n", a_ovP->bufMisses); | |
460 | printf("\t%10d bufFlushDirty\n", a_ovP->bufFlushDirty); | |
461 | ||
462 | printf("\t%10d LargeBlocksActive\n", a_ovP->LargeBlocksActive); | |
463 | printf("\t%10d LargeBlocksAlloced\n", a_ovP->LargeBlocksAlloced); | |
464 | printf("\t%10d SmallBlocksActive\n", a_ovP->SmallBlocksActive); | |
465 | printf("\t%10d SmallBlocksAlloced\n", a_ovP->SmallBlocksAlloced); | |
466 | printf("\t%10d OutStandingMemUsage\n", a_ovP->OutStandingMemUsage); | |
467 | printf("\t%10d OutStandingAllocs\n", a_ovP->OutStandingAllocs); | |
468 | printf("\t%10d CallBackAlloced\n", a_ovP->CallBackAlloced); | |
469 | printf("\t%10d CallBackFlushes\n", a_ovP->CallBackFlushes); | |
470 | ||
471 | printf("\t%10d srvRecords\n", a_ovP->srvRecords); | |
472 | printf("\t%10d srvNumBuckets\n", a_ovP->srvNumBuckets); | |
473 | printf("\t%10d srvMaxChainLength\n", a_ovP->srvMaxChainLength); | |
474 | printf("\t%10d srvMaxChainLengthHWM\n", a_ovP->srvMaxChainLengthHWM); | |
475 | printf("\t%10d srvRecordsHWM\n", a_ovP->srvRecordsHWM); | |
476 | ||
477 | printf("\t%10d sysName_ID\n", a_ovP->sysName_ID); | |
478 | ||
479 | printf("\tFile Server up/downtimes, same cell:\n"); | |
480 | Print_cm_UpDownStats(&(a_ovP->fs_UpDown[0])); | |
481 | ||
482 | printf("\tFile Server up/downtimes, diff cell:\n"); | |
483 | Print_cm_UpDownStats(&(a_ovP->fs_UpDown[1])); | |
484 | ||
485 | printf("\tVL Server up/downtimes, same cell:\n"); | |
486 | Print_cm_UpDownStats(&(a_ovP->vl_UpDown[0])); | |
487 | ||
488 | printf("\tVL Server up/downtimes, diff cell:\n"); | |
489 | Print_cm_UpDownStats(&(a_ovP->vl_UpDown[1])); | |
490 | ||
491 | } /*Print_cm_OverallPerfInfo */ | |
492 | ||
493 | ||
494 | ||
495 | /*------------------------------------------------------------------------ | |
496 | * Print_cm_OpTiming | |
497 | * | |
498 | * Description: | |
499 | * Print out the contents of an FS RPC op timing structure. | |
500 | * | |
501 | * Arguments: | |
502 | * a_opIdx : Index of the AFS operation we're printing number on. | |
503 | * a_opNames : Ptr to table of operaton names. | |
504 | * a_opTimeP : Ptr to the op timing structure to print. | |
505 | * | |
506 | *------------------------------------------------------------------------*/ | |
507 | ||
508 | void | |
509 | Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP) | |
510 | int a_opIdx; | |
511 | char *a_opNames[]; | |
512 | struct afs_stats_opTimingData *a_opTimeP; | |
513 | ||
514 | { /*Print_cm_OpTiming */ | |
515 | ||
516 | printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n", | |
517 | a_opNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses, | |
518 | a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec, | |
519 | a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec, | |
520 | a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec); | |
521 | ||
522 | } /*Print_cm_OpTiming */ | |
523 | ||
524 | ||
525 | /*------------------------------------------------------------------------ | |
526 | * Print_cm_XferTiming | |
527 | * | |
528 | * Description: | |
529 | * Print out the contents of a data transfer structure. | |
530 | * | |
531 | * Arguments: | |
532 | * a_opIdx : Index of the AFS operation we're printing number on. | |
533 | * a_xferP : Ptr to the data transfer structure to print. | |
534 | * | |
535 | *------------------------------------------------------------------------*/ | |
536 | ||
537 | void | |
538 | Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP) | |
539 | int a_opIdx; | |
540 | char *a_opNames[]; | |
541 | struct afs_stats_xferData *a_xferP; | |
542 | ||
543 | { /*Print_cm_XferTiming */ | |
544 | ||
545 | printf | |
546 | ("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n", | |
547 | a_opNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses, | |
548 | a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec, | |
549 | a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec, | |
550 | a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec); | |
551 | printf("\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes, | |
552 | a_xferP->minBytes, a_xferP->maxBytes); | |
553 | printf | |
554 | ("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d, 7: %d, 8: %d]\n", | |
555 | a_xferP->count[0], a_xferP->count[1], a_xferP->count[2], | |
556 | a_xferP->count[3], a_xferP->count[4], a_xferP->count[5], | |
557 | a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]); | |
558 | ||
559 | } /*Print_cm_XferTiming */ | |
560 | ||
561 | ||
562 | /*------------------------------------------------------------------------ | |
563 | * Print_cm_ErrInfo | |
564 | * | |
565 | * Description: | |
566 | * Print out the contents of an FS RPC error info structure. | |
567 | * | |
568 | * Arguments: | |
569 | * a_opIdx : Index of the AFS operation we're printing. | |
570 | * a_opNames : Ptr to table of operation names. | |
571 | * a_opErrP : Ptr to the op timing structure to print. | |
572 | * | |
573 | *------------------------------------------------------------------------*/ | |
574 | ||
575 | void | |
576 | Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP) | |
577 | int a_opIdx; | |
578 | char *a_opNames[]; | |
579 | struct afs_stats_RPCErrors *a_opErrP; | |
580 | ||
581 | { /*Print_cm_ErrInfo */ | |
582 | ||
583 | printf | |
584 | ("%15s: %d server, %d network, %d prot, %d vol, %d busies, %d other\n", | |
585 | a_opNames[a_opIdx], a_opErrP->err_Server, a_opErrP->err_Network, | |
586 | a_opErrP->err_Protection, a_opErrP->err_Volume, | |
587 | a_opErrP->err_VolumeBusies, a_opErrP->err_Other); | |
588 | ||
589 | } /*Print_cm_ErrInfo */ | |
590 | ||
591 | ||
592 | /*------------------------------------------------------------------------ | |
593 | * Print_cm_RPCPerfInfo | |
594 | * | |
595 | * Description: | |
596 | * Print out a set of RPC performance numbers. | |
597 | * | |
598 | * Arguments: | |
599 | * a_rpcP : Ptr to RPC perf numbers to print. | |
600 | * | |
601 | *------------------------------------------------------------------------*/ | |
602 | ||
603 | void | |
604 | Print_cm_RPCPerfInfo(a_rpcP) | |
605 | struct afs_stats_RPCOpInfo *a_rpcP; | |
606 | ||
607 | { /*Print_cm_RPCPerfInfo */ | |
608 | ||
609 | int currIdx; /*Loop variable */ | |
610 | ||
611 | /* | |
612 | * Print the contents of each of the opcode-related arrays. | |
613 | */ | |
614 | printf("FS Operation Timings:\n---------------------\n"); | |
615 | for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++) | |
616 | Print_cm_OpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx])); | |
617 | ||
618 | printf("\nError Info:\n-----------\n"); | |
619 | for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++) | |
620 | Print_cm_ErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx])); | |
621 | ||
622 | printf("\nTransfer timings:\n-----------------\n"); | |
623 | for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++) | |
624 | Print_cm_XferTiming(currIdx, xferOpNames, | |
625 | &(a_rpcP->fsXferTimes[currIdx])); | |
626 | ||
627 | printf("\nCM Operation Timings:\n---------------------\n"); | |
628 | for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++) | |
629 | Print_cm_OpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx])); | |
630 | ||
631 | } /*Print_cm_RPCPerfInfo */ | |
632 | ||
633 | ||
634 | /*------------------------------------------------------------------------ | |
635 | * Print_cm_FullPerfInfo | |
636 | * | |
637 | * Description: | |
638 | * Print out a set of full performance numbers. | |
639 | * | |
640 | * Arguments: | |
641 | * None. | |
642 | * | |
643 | *------------------------------------------------------------------------*/ | |
644 | ||
645 | void | |
646 | Print_cm_FullPerfInfo(a_fullP) | |
647 | struct afs_stats_CMFullPerf *a_fullP; | |
648 | { /*Print_cm_FullPerfInfo */ | |
649 | ||
650 | static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */ | |
651 | struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats */ | |
652 | struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats */ | |
653 | struct afs_stats_AuthorInfo *authorP; /*Ptr to authorship stats */ | |
654 | static long fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2); /*Correct #longs */ | |
655 | long numLongs; /*# longs actually received */ | |
656 | struct afs_stats_CMFullPerf *fullP; | |
657 | ||
658 | fullP = a_fullP; | |
659 | ||
660 | /* | |
661 | * Print the overall numbers first, followed by all of the RPC numbers, | |
662 | * then each of the other groupings. | |
663 | */ | |
664 | printf("Overall Performance Info:\n-------------------------\n"); | |
665 | Print_cm_OverallPerfInfo(&(fullP->perf)); | |
666 | printf("\n"); | |
667 | Print_cm_RPCPerfInfo(&(fullP->rpc)); | |
668 | ||
669 | authentP = &(fullP->authent); | |
670 | printf("\nAuthentication info:\n--------------------\n"); | |
671 | printf | |
672 | ("\t%d PAGS, %d records (%d auth, %d unauth), %d max in PAG, chain max: %d\n", | |
673 | authentP->curr_PAGs, authentP->curr_Records, | |
674 | authentP->curr_AuthRecords, authentP->curr_UnauthRecords, | |
675 | authentP->curr_MaxRecordsInPAG, authentP->curr_LongestChain); | |
676 | printf("\t%d PAG creations, %d tkt updates\n", authentP->PAGCreations, | |
677 | authentP->TicketUpdates); | |
678 | printf("\t[HWMs: %d PAGS, %d records, %d max in PAG, chain max: %d]\n", | |
679 | authentP->HWM_PAGs, authentP->HWM_Records, | |
680 | authentP->HWM_MaxRecordsInPAG, authentP->HWM_LongestChain); | |
681 | ||
682 | accessinfP = &(fullP->accessinf); | |
683 | printf("\n[Un]replicated accesses:\n------------------------\n"); | |
684 | printf | |
685 | ("\t%d unrep, %d rep, %d reps accessed, %d max reps/ref, %d first OK\n\n", | |
686 | accessinfP->unreplicatedRefs, accessinfP->replicatedRefs, | |
687 | accessinfP->numReplicasAccessed, accessinfP->maxReplicasPerRef, | |
688 | accessinfP->refFirstReplicaOK); | |
689 | ||
690 | /* There really isn't any authorship info | |
691 | * authorP = &(fullP->author); */ | |
692 | ||
693 | } /*Print_cm_FullPerfInfo */ | |
694 | ||
695 | ||
696 | ||
697 | ||
698 | main(argc, argv) | |
699 | int argc; | |
700 | char *argv[]; | |
701 | { | |
702 | static char rn[] = "main"; | |
703 | FILE *inFD; | |
704 | char *line, *charPtr; | |
705 | long *longs, *longPtr; | |
706 | int block_size, exitcode, i, numLongs, counter; | |
707 | char day[5], month[5], date[5], time[10], year[5], hostname[80], | |
708 | hosttype[5]; | |
709 | struct afs_stats_CMFullPerf *cmPerfP; | |
710 | struct fs_stats_FullPerfStats *fsPerfP; | |
711 | char tmpstr[20]; | |
712 | ||
713 | ||
714 | if ((argc < 2) || (strcasecmp(argv[1], "-h") == 0) | |
715 | || (strcasecmp(argv[1], "-help") == 0) | |
716 | || (strcasecmp(argv[1], "help") == 0)) { | |
717 | fprintf(stderr, "\nUsage: %s <file>\n", argv[0]); | |
718 | fprintf(stderr, | |
719 | "\twhere <file> is the output generated by AFSMonitor\n\n"); | |
720 | exit(1); | |
721 | } | |
722 | ||
723 | ||
724 | ||
725 | inFD = fopen(argv[1], "r"); | |
726 | if (inFD == (FILE *) 0) { | |
727 | fprintf(stderr, "\n[ %s ] Unable to open input file %s. \n", rn, | |
728 | argv[1]); | |
729 | exit(5); | |
730 | } | |
731 | ||
732 | block_size = XSTAT_CM_FULLPERF_RESULTS_LEN * sizeof(long); | |
733 | ||
734 | /* Malloc two blocks of data, one for reading each line from the data file | |
735 | * and the other for coverting data to longs */ | |
736 | ||
737 | if ((line = malloc(block_size + 256)) == NULL) { | |
738 | fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn, | |
739 | block_size + 256); | |
740 | exit(10); | |
741 | } | |
742 | ||
743 | if ((longs = malloc(block_size)) == NULL) { | |
744 | fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn, block_size); | |
745 | exit(20); | |
746 | } | |
747 | ||
748 | /* Parse the data file */ | |
749 | while (1) { | |
750 | if (fgets(line, block_size, inFD) == NULL) { | |
751 | exitcode = 0; | |
752 | goto FINISH; | |
753 | } | |
754 | if (strlen(line) < 5) | |
755 | continue; | |
756 | ||
757 | /* Parse the date, hostname, and hosttype (FS or CM) */ | |
758 | ||
759 | charPtr = line; | |
760 | sscanf(charPtr, "%s %s %s %s %s %s %s", day, month, date, time, year, | |
761 | hostname, hosttype); | |
762 | charPtr += | |
763 | strlen(day) + strlen(month) + strlen(date) + strlen(time) + | |
764 | strlen(year) + strlen(hostname) + strlen(hosttype) + 8; | |
765 | ||
766 | printf("\n\n%s %s %s %s %s %s %s \n\n", day, month, date, time, year, | |
767 | hostname, hosttype); | |
768 | ||
769 | /* Check the first datum. If it is -1 the probe had failed */ | |
770 | ||
771 | sscanf(charPtr, "%s", tmpstr); | |
772 | if (atoi(tmpstr) == -1) { | |
773 | printf("Probe failed, no data to process.\n"); | |
774 | continue; | |
775 | } | |
776 | ||
777 | /* Convert the data to longs */ | |
778 | ||
779 | if (strcmp(hosttype, "FS") == 0) | |
780 | numLongs = XSTAT_FS_FULLPERF_RESULTS_LEN; | |
781 | else if (strcmp(hosttype, "CM") == 0) | |
782 | numLongs = XSTAT_CM_FULLPERF_RESULTS_LEN; | |
783 | else { | |
784 | fprintf(stderr, "Cannot determine hosttype %s\n", hosttype); | |
785 | fprintf(stderr, "Skipping this entry\n"); | |
786 | continue; | |
787 | } | |
788 | ||
789 | longPtr = longs; | |
790 | counter = 0; | |
791 | for (i = 0; i < numLongs; i++) { | |
792 | sscanf(charPtr, "%ld", longPtr); | |
793 | sscanf(charPtr, "%s", tmpstr); | |
794 | longPtr++; | |
795 | charPtr += strlen(tmpstr) + 1; | |
796 | counter++; | |
797 | } | |
798 | ||
799 | /* Verify that we read the correct number of longs and print them */ | |
800 | ||
801 | if (strcmp(hosttype, "CM") == 0) { | |
802 | if (counter == XSTAT_CM_FULLPERF_RESULTS_LEN) | |
803 | Print_cm_FullPerfInfo((struct afs_stats_CMFullPerf *)longs); | |
804 | else | |
805 | fprintf(stderr, | |
806 | "Data size mismatch error. Expected %d longs, found %d longs\n", | |
807 | numLongs, counter); | |
808 | } else { | |
809 | if (counter == XSTAT_FS_FULLPERF_RESULTS_LEN) { | |
810 | fsPerfP = (struct fs_stats_FullPerfStats *)longs; | |
811 | Print_fs_OverallPerfInfo(&(fsPerfP->overall)); | |
812 | Print_fs_DetailedPerfInfo(&(fsPerfP->det)); | |
813 | } else | |
814 | fprintf(stderr, | |
815 | "Data size mismatch error. Expected %d longs, found %d longs\n", | |
816 | numLongs, counter); | |
817 | ||
818 | } | |
819 | ||
820 | printf | |
821 | ("\n-------------------------------------------------------------------------\n"); | |
822 | } /* while */ | |
823 | ||
824 | exitcode = 0; | |
825 | ||
826 | FINISH: | |
827 | fclose(inFD); | |
828 | free(line); | |
829 | free(longs); | |
830 | } |