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 * 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.
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.
18 *-------------------------------------------------------------------------*/
21 #include <afsconfig.h>
22 #include <afs/param.h>
27 #include <afs/xstat_fs.h>
28 #include <afs/xstat_cm.h>
32 /* Number of items of CM & FS statistics collected per probe.
33 These constants MUST be changed if the xstat structures are modified */
35 #define XSTAT_CM_FULLPERF_RESULTS_LEN 740
36 #define XSTAT_FS_FULLPERF_RESULTS_LEN 424
39 /* structures used by FS & CM stats print routines */
41 static char *fsOpNames[] = {
72 static char *cmOpNames[] = {
82 static char *xferOpNames[] = {
87 /*________________________________________________________________________
89 *_______________________________________________________________________*/
91 /*------------------------------------------------------------------------
92 * Print_fs_OverallPerfInfo
95 * Print out overall performance numbers.
98 * a_ovP : Ptr to the overall performance numbers.
100 *------------------------------------------------------------------------*/
103 Print_fs_OverallPerfInfo(a_ovP)
104 struct afs_PerfStats *a_ovP;
106 { /*Print_fs_OverallPerfInfo */
108 printf("\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls);
112 * Vnode cache section.
114 printf("\t%10d vcache_L_Entries\n", a_ovP->vcache_L_Entries);
115 printf("\t%10d vcache_L_Allocs\n", a_ovP->vcache_L_Allocs);
116 printf("\t%10d vcache_L_Gets\n", a_ovP->vcache_L_Gets);
117 printf("\t%10d vcache_L_Reads\n", a_ovP->vcache_L_Reads);
118 printf("\t%10d vcache_L_Writes\n\n", a_ovP->vcache_L_Writes);
120 printf("\t%10d vcache_S_Entries\n", a_ovP->vcache_S_Entries);
121 printf("\t%10d vcache_S_Allocs\n", a_ovP->vcache_S_Allocs);
122 printf("\t%10d vcache_S_Gets\n", a_ovP->vcache_S_Gets);
123 printf("\t%10d vcache_S_Reads\n", a_ovP->vcache_S_Reads);
124 printf("\t%10d vcache_S_Writes\n\n", a_ovP->vcache_S_Writes);
126 printf("\t%10d vcache_H_Entries\n", a_ovP->vcache_H_Entries);
127 printf("\t%10d vcache_H_Gets\n", a_ovP->vcache_H_Gets);
128 printf("\t%10d vcache_H_Replacements\n\n", a_ovP->vcache_H_Replacements);
131 * Directory package section.
133 printf("\t%10d dir_Buffers\n", a_ovP->dir_Buffers);
134 printf("\t%10d dir_Calls\n", a_ovP->dir_Calls);
135 printf("\t%10d dir_IOs\n\n", a_ovP->dir_IOs);
140 printf("\t%10d rx_packetRequests\n", a_ovP->rx_packetRequests);
141 printf("\t%10d rx_noPackets_RcvClass\n", a_ovP->rx_noPackets_RcvClass);
142 printf("\t%10d rx_noPackets_SendClass\n", a_ovP->rx_noPackets_SendClass);
143 printf("\t%10d rx_noPackets_SpecialClass\n",
144 a_ovP->rx_noPackets_SpecialClass);
145 printf("\t%10d rx_socketGreedy\n", a_ovP->rx_socketGreedy);
146 printf("\t%10d rx_bogusPacketOnRead\n", a_ovP->rx_bogusPacketOnRead);
147 printf("\t%10d rx_bogusHost\n", a_ovP->rx_bogusHost);
148 printf("\t%10d rx_noPacketOnRead\n", a_ovP->rx_noPacketOnRead);
149 printf("\t%10d rx_noPacketBuffersOnRead\n",
150 a_ovP->rx_noPacketBuffersOnRead);
151 printf("\t%10d rx_selects\n", a_ovP->rx_selects);
152 printf("\t%10d rx_sendSelects\n", a_ovP->rx_sendSelects);
153 printf("\t%10d rx_packetsRead_RcvClass\n",
154 a_ovP->rx_packetsRead_RcvClass);
155 printf("\t%10d rx_packetsRead_SendClass\n",
156 a_ovP->rx_packetsRead_SendClass);
157 printf("\t%10d rx_packetsRead_SpecialClass\n",
158 a_ovP->rx_packetsRead_SpecialClass);
159 printf("\t%10d rx_dataPacketsRead\n", a_ovP->rx_dataPacketsRead);
160 printf("\t%10d rx_ackPacketsRead\n", a_ovP->rx_ackPacketsRead);
161 printf("\t%10d rx_dupPacketsRead\n", a_ovP->rx_dupPacketsRead);
162 printf("\t%10d rx_spuriousPacketsRead\n", a_ovP->rx_spuriousPacketsRead);
163 printf("\t%10d rx_packetsSent_RcvClass\n",
164 a_ovP->rx_packetsSent_RcvClass);
165 printf("\t%10d rx_packetsSent_SendClass\n",
166 a_ovP->rx_packetsSent_SendClass);
167 printf("\t%10d rx_packetsSent_SpecialClass\n",
168 a_ovP->rx_packetsSent_SpecialClass);
169 printf("\t%10d rx_ackPacketsSent\n", a_ovP->rx_ackPacketsSent);
170 printf("\t%10d rx_pingPacketsSent\n", a_ovP->rx_pingPacketsSent);
171 printf("\t%10d rx_abortPacketsSent\n", a_ovP->rx_abortPacketsSent);
172 printf("\t%10d rx_busyPacketsSent\n", a_ovP->rx_busyPacketsSent);
173 printf("\t%10d rx_dataPacketsSent\n", a_ovP->rx_dataPacketsSent);
174 printf("\t%10d rx_dataPacketsReSent\n", a_ovP->rx_dataPacketsReSent);
175 printf("\t%10d rx_dataPacketsPushed\n", a_ovP->rx_dataPacketsPushed);
176 printf("\t%10d rx_ignoreAckedPacket\n", a_ovP->rx_ignoreAckedPacket);
177 printf("\t%10d rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec);
178 printf("\t%10d rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec);
179 printf("\t%10d rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec);
180 printf("\t%10d rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec);
181 printf("\t%10d rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec);
182 printf("\t%10d rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec);
183 printf("\t%10d rx_nRttSamples\n", a_ovP->rx_nRttSamples);
184 printf("\t%10d rx_nServerConns\n", a_ovP->rx_nServerConns);
185 printf("\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns);
186 printf("\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs);
187 printf("\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs);
188 printf("\t%10d rx_nFreeCallStructs\n\n", a_ovP->rx_nFreeCallStructs);
191 * Host module fields.
193 printf("\t%10d host_NumHostEntries\n", a_ovP->host_NumHostEntries);
194 printf("\t%10d host_HostBlocks\n", a_ovP->host_HostBlocks);
195 printf("\t%10d host_NonDeletedHosts\n", a_ovP->host_NonDeletedHosts);
196 printf("\t%10d host_HostsInSameNetOrSubnet\n",
197 a_ovP->host_HostsInSameNetOrSubnet);
198 printf("\t%10d host_HostsInDiffSubnet\n", a_ovP->host_HostsInDiffSubnet);
199 printf("\t%10d host_HostsInDiffNetwork\n",
200 a_ovP->host_HostsInDiffNetwork);
201 printf("\t%10d host_NumClients\n", a_ovP->host_NumClients);
202 printf("\t%10d host_ClientBlocks\n\n", a_ovP->host_ClientBlocks);
204 } /*Print_fs_OverallPerfInfo */
207 /*------------------------------------------------------------------------
211 * Print out the contents of an RPC op timing structure.
214 * a_opIdx : Index of the AFS operation we're printing number on.
215 * a_opTimeP : Ptr to the op timing structure to print.
217 *------------------------------------------------------------------------*/
220 Print_fs_OpTiming(a_opIdx, a_opTimeP)
222 struct fs_stats_opTimingData *a_opTimeP;
224 { /*Print_fs_OpTiming */
226 printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
227 fsOpNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
228 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
229 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
230 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
232 } /*Print_fs_OpTiming */
235 /*------------------------------------------------------------------------
236 * Print_fs_XferTiming
239 * Print out the contents of a data transfer structure.
242 * a_opIdx : Index of the AFS operation we're printing number on.
243 * a_xferP : Ptr to the data transfer structure to print.
245 *------------------------------------------------------------------------*/
248 Print_fs_XferTiming(a_opIdx, a_xferP)
250 struct fs_stats_xferData *a_xferP;
252 { /*Print_fs_XferTiming */
255 ("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
256 xferOpNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
257 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
258 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
259 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
260 printf("\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes,
261 a_xferP->minBytes, a_xferP->maxBytes);
263 ("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d 7:%d 8:%d]\n",
264 a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
265 a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
266 a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);
268 } /*Print_fs_XferTiming */
271 /*------------------------------------------------------------------------
272 * Print_fs_DetailedPerfInfo
275 * Print out a set of detailed performance numbers.
278 * a_detP : Ptr to detailed perf numbers to print.
280 *------------------------------------------------------------------------*/
283 Print_fs_DetailedPerfInfo(a_detP)
284 struct fs_stats_DetailedStats *a_detP;
286 { /*Print_fs_DetailedPerfInfo */
288 int currIdx; /*Loop variable */
290 printf("\t%10d epoch\n", a_detP->epoch);
292 for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
293 Print_fs_OpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]));
295 for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
296 Print_fs_XferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]));
298 } /*Print_fs_DetailedPerfInfo */
301 /*------------------------------------------------------------------------
302 * Print_fs_FullPerfInfo
305 * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just
311 *------------------------------------------------------------------------*/
314 Print_fs_FullPerfInfo(a_fs_Results)
315 struct xstat_fs_ProbeResults *a_fs_Results; /* ptr to fs results */
316 { /*Print_fs_FullPerfInfo */
318 static char rn[] = "Print_fs_FullPerfInfo"; /*Routine name */
319 static long fullPerfLongs = (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # longs to rcv */
320 long numLongs; /*# longwords received */
321 struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */
322 char *printableTime; /*Ptr to printable time string */
325 numLongs = a_fs_Results->data.AFS_CollData_len;
326 if (numLongs != fullPerfLongs) {
327 printf(" ** Data size mismatch in full performance collection!\n");
328 printf(" ** Expecting %d, got %d\n", fullPerfLongs, numLongs);
332 printableTime = ctime(&(a_fs_Results->probeTime));
333 printableTime[strlen(printableTime) - 1] = '\0';
334 fullPerfP = (struct fs_stats_FullPerfStats *)
335 (a_fs_Results->data.AFS_CollData_val);
338 ("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
339 a_fs_Results->collectionNumber, a_fs_Results->connP->hostName,
340 a_fs_Results->probeNum, printableTime);
342 Print_fs_OverallPerfInfo(&(fullPerfP->overall));
343 Print_fs_DetailedPerfInfo(&(fullPerfP->det));
345 } /*Print_fs_FullPerfInfo */
349 /*___________________________________________________________________________
351 *__________________________________________________________________________*/
355 /*------------------------------------------------------------------------
356 * Print_cm_UpDownStats
359 * Print the up/downtime stats for the given class of server records
363 * a_upDownP : Ptr to the server up/down info.
365 *------------------------------------------------------------------------*/
368 Print_cm_UpDownStats(a_upDownP)
369 struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */
371 { /*Print_cm_UpDownStats */
374 * First, print the simple values.
376 printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
377 printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
378 printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
379 printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
380 printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
381 printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
382 printf("\t\t%10d numDowntimeIncidents\n",
383 a_upDownP->numDowntimeIncidents);
384 printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
385 printf("\t\t%10d maxDowntimesInARecord\n",
386 a_upDownP->maxDowntimesInARecord);
387 printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
388 printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
389 printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
392 * Now, print the array values.
394 printf("\t\tDowntime duration distribution:\n");
395 printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
396 printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
397 printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
398 printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
399 printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
400 printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
401 printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
403 printf("\t\tDowntime incident distribution:\n");
404 printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
405 printf("\t\t\t%8d: 1 time\n", a_upDownP->downIncidents[1]);
406 printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downIncidents[2]);
407 printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downIncidents[3]);
408 printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downIncidents[4]);
409 printf("\t\t\t%8d: > 50 times\n", a_upDownP->downIncidents[5]);
411 } /*Print_cm_UpDownStats */
414 /*------------------------------------------------------------------------
415 * Print_cm_OverallPerfInfo
418 * Print out overall performance numbers.
421 * a_ovP : Ptr to the overall performance numbers.
423 *------------------------------------------------------------------------*/
426 Print_cm_OverallPerfInfo(a_ovP)
427 struct afs_stats_CMPerf *a_ovP;
429 { /*Print_cm_OverallPerfInfo */
431 printf("\t%10d numPerfCalls\n", a_ovP->numPerfCalls);
433 printf("\t%10d epoch\n", a_ovP->epoch);
434 printf("\t%10d numCellsVisible\n", a_ovP->numCellsVisible);
435 printf("\t%10d numCellsContacted\n", a_ovP->numCellsContacted);
436 printf("\t%10d dlocalAccesses\n", a_ovP->dlocalAccesses);
437 printf("\t%10d vlocalAccesses\n", a_ovP->vlocalAccesses);
438 printf("\t%10d dremoteAccesses\n", a_ovP->dremoteAccesses);
439 printf("\t%10d vremoteAccesses\n", a_ovP->vremoteAccesses);
440 printf("\t%10d cacheNumEntries\n", a_ovP->cacheNumEntries);
441 printf("\t%10d cacheBlocksTotal\n", a_ovP->cacheBlocksTotal);
442 printf("\t%10d cacheBlocksInUse\n", a_ovP->cacheBlocksInUse);
443 printf("\t%10d cacheBlocksOrig\n", a_ovP->cacheBlocksOrig);
444 printf("\t%10d cacheMaxDirtyChunks\n", a_ovP->cacheMaxDirtyChunks);
445 printf("\t%10d cacheCurrDirtyChunks\n", a_ovP->cacheCurrDirtyChunks);
446 printf("\t%10d dcacheHits\n", a_ovP->dcacheHits);
447 printf("\t%10d vcacheHits\n", a_ovP->vcacheHits);
448 printf("\t%10d dcacheMisses\n", a_ovP->dcacheMisses);
449 printf("\t%10d vcacheMisses\n", a_ovP->vcacheMisses);
450 printf("\t%10d cacheFilesReused\n", a_ovP->cacheFilesReused);
451 printf("\t%10d vcacheXAllocs\n", a_ovP->vcacheXAllocs);
453 printf("\t%10d bufAlloced\n", a_ovP->bufAlloced);
454 printf("\t%10d bufHits\n", a_ovP->bufHits);
455 printf("\t%10d bufMisses\n", a_ovP->bufMisses);
456 printf("\t%10d bufFlushDirty\n", a_ovP->bufFlushDirty);
458 printf("\t%10d LargeBlocksActive\n", a_ovP->LargeBlocksActive);
459 printf("\t%10d LargeBlocksAlloced\n", a_ovP->LargeBlocksAlloced);
460 printf("\t%10d SmallBlocksActive\n", a_ovP->SmallBlocksActive);
461 printf("\t%10d SmallBlocksAlloced\n", a_ovP->SmallBlocksAlloced);
462 printf("\t%10d OutStandingMemUsage\n", a_ovP->OutStandingMemUsage);
463 printf("\t%10d OutStandingAllocs\n", a_ovP->OutStandingAllocs);
464 printf("\t%10d CallBackAlloced\n", a_ovP->CallBackAlloced);
465 printf("\t%10d CallBackFlushes\n", a_ovP->CallBackFlushes);
467 printf("\t%10d srvRecords\n", a_ovP->srvRecords);
468 printf("\t%10d srvNumBuckets\n", a_ovP->srvNumBuckets);
469 printf("\t%10d srvMaxChainLength\n", a_ovP->srvMaxChainLength);
470 printf("\t%10d srvMaxChainLengthHWM\n", a_ovP->srvMaxChainLengthHWM);
471 printf("\t%10d srvRecordsHWM\n", a_ovP->srvRecordsHWM);
473 printf("\t%10d sysName_ID\n", a_ovP->sysName_ID);
475 printf("\tFile Server up/downtimes, same cell:\n");
476 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[0]));
478 printf("\tFile Server up/downtimes, diff cell:\n");
479 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[1]));
481 printf("\tVL Server up/downtimes, same cell:\n");
482 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[0]));
484 printf("\tVL Server up/downtimes, diff cell:\n");
485 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[1]));
487 } /*Print_cm_OverallPerfInfo */
491 /*------------------------------------------------------------------------
495 * Print out the contents of an FS RPC op timing structure.
498 * a_opIdx : Index of the AFS operation we're printing number on.
499 * a_opNames : Ptr to table of operaton names.
500 * a_opTimeP : Ptr to the op timing structure to print.
502 *------------------------------------------------------------------------*/
505 Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP)
508 struct afs_stats_opTimingData *a_opTimeP;
510 { /*Print_cm_OpTiming */
512 printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
513 a_opNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
514 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
515 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
516 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
518 } /*Print_cm_OpTiming */
521 /*------------------------------------------------------------------------
522 * Print_cm_XferTiming
525 * Print out the contents of a data transfer structure.
528 * a_opIdx : Index of the AFS operation we're printing number on.
529 * a_xferP : Ptr to the data transfer structure to print.
531 *------------------------------------------------------------------------*/
534 Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP)
537 struct afs_stats_xferData *a_xferP;
539 { /*Print_cm_XferTiming */
542 ("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
543 a_opNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
544 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
545 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
546 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
547 printf("\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes,
548 a_xferP->minBytes, a_xferP->maxBytes);
550 ("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d, 7: %d, 8: %d]\n",
551 a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
552 a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
553 a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);
555 } /*Print_cm_XferTiming */
558 /*------------------------------------------------------------------------
562 * Print out the contents of an FS RPC error info structure.
565 * a_opIdx : Index of the AFS operation we're printing.
566 * a_opNames : Ptr to table of operation names.
567 * a_opErrP : Ptr to the op timing structure to print.
569 *------------------------------------------------------------------------*/
572 Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP)
575 struct afs_stats_RPCErrors *a_opErrP;
577 { /*Print_cm_ErrInfo */
580 ("%15s: %d server, %d network, %d prot, %d vol, %d busies, %d other\n",
581 a_opNames[a_opIdx], a_opErrP->err_Server, a_opErrP->err_Network,
582 a_opErrP->err_Protection, a_opErrP->err_Volume,
583 a_opErrP->err_VolumeBusies, a_opErrP->err_Other);
585 } /*Print_cm_ErrInfo */
588 /*------------------------------------------------------------------------
589 * Print_cm_RPCPerfInfo
592 * Print out a set of RPC performance numbers.
595 * a_rpcP : Ptr to RPC perf numbers to print.
597 *------------------------------------------------------------------------*/
600 Print_cm_RPCPerfInfo(a_rpcP)
601 struct afs_stats_RPCOpInfo *a_rpcP;
603 { /*Print_cm_RPCPerfInfo */
605 int currIdx; /*Loop variable */
608 * Print the contents of each of the opcode-related arrays.
610 printf("FS Operation Timings:\n---------------------\n");
611 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
612 Print_cm_OpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx]));
614 printf("\nError Info:\n-----------\n");
615 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
616 Print_cm_ErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx]));
618 printf("\nTransfer timings:\n-----------------\n");
619 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++)
620 Print_cm_XferTiming(currIdx, xferOpNames,
621 &(a_rpcP->fsXferTimes[currIdx]));
623 printf("\nCM Operation Timings:\n---------------------\n");
624 for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
625 Print_cm_OpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]));
627 } /*Print_cm_RPCPerfInfo */
630 /*------------------------------------------------------------------------
631 * Print_cm_FullPerfInfo
634 * Print out a set of full performance numbers.
639 *------------------------------------------------------------------------*/
642 Print_cm_FullPerfInfo(a_fullP)
643 struct afs_stats_CMFullPerf *a_fullP;
644 { /*Print_cm_FullPerfInfo */
646 static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */
647 struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats */
648 struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats */
649 struct afs_stats_AuthorInfo *authorP; /*Ptr to authorship stats */
650 static long fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2); /*Correct #longs */
651 long numLongs; /*# longs actually received */
652 struct afs_stats_CMFullPerf *fullP;
657 * Print the overall numbers first, followed by all of the RPC numbers,
658 * then each of the other groupings.
660 printf("Overall Performance Info:\n-------------------------\n");
661 Print_cm_OverallPerfInfo(&(fullP->perf));
663 Print_cm_RPCPerfInfo(&(fullP->rpc));
665 authentP = &(fullP->authent);
666 printf("\nAuthentication info:\n--------------------\n");
668 ("\t%d PAGS, %d records (%d auth, %d unauth), %d max in PAG, chain max: %d\n",
669 authentP->curr_PAGs, authentP->curr_Records,
670 authentP->curr_AuthRecords, authentP->curr_UnauthRecords,
671 authentP->curr_MaxRecordsInPAG, authentP->curr_LongestChain);
672 printf("\t%d PAG creations, %d tkt updates\n", authentP->PAGCreations,
673 authentP->TicketUpdates);
674 printf("\t[HWMs: %d PAGS, %d records, %d max in PAG, chain max: %d]\n",
675 authentP->HWM_PAGs, authentP->HWM_Records,
676 authentP->HWM_MaxRecordsInPAG, authentP->HWM_LongestChain);
678 accessinfP = &(fullP->accessinf);
679 printf("\n[Un]replicated accesses:\n------------------------\n");
681 ("\t%d unrep, %d rep, %d reps accessed, %d max reps/ref, %d first OK\n\n",
682 accessinfP->unreplicatedRefs, accessinfP->replicatedRefs,
683 accessinfP->numReplicasAccessed, accessinfP->maxReplicasPerRef,
684 accessinfP->refFirstReplicaOK);
686 /* There really isn't any authorship info
687 * authorP = &(fullP->author); */
689 } /*Print_cm_FullPerfInfo */
698 static char rn[] = "main";
700 char *line, *charPtr;
701 long *longs, *longPtr;
702 int block_size, exitcode, i, numLongs, counter;
703 char day[5], month[5], date[5], time[10], year[5], hostname[80],
705 struct afs_stats_CMFullPerf *cmPerfP;
706 struct fs_stats_FullPerfStats *fsPerfP;
710 if ((argc < 2) || (strcasecmp(argv[1], "-h") == 0)
711 || (strcasecmp(argv[1], "-help") == 0)
712 || (strcasecmp(argv[1], "help") == 0)) {
713 fprintf(stderr, "\nUsage: %s <file>\n", argv[0]);
715 "\twhere <file> is the output generated by AFSMonitor\n\n");
721 inFD = fopen(argv[1], "r");
722 if (inFD == (FILE *) 0) {
723 fprintf(stderr, "\n[ %s ] Unable to open input file %s. \n", rn,
728 block_size = XSTAT_CM_FULLPERF_RESULTS_LEN * sizeof(long);
730 /* Malloc two blocks of data, one for reading each line from the data file
731 * and the other for coverting data to longs */
733 if ((line = malloc(block_size + 256)) == (char *)NULL) {
734 fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn,
739 if ((longs = malloc(block_size)) == (long *)NULL) {
740 fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn, block_size);
744 /* Parse the data file */
746 if (fgets(line, block_size, inFD) == NULL) {
750 if (strlen(line) < 5)
753 /* Parse the date, hostname, and hosttype (FS or CM) */
756 sscanf(charPtr, "%s %s %s %s %s %s %s", day, month, date, time, year,
759 strlen(day) + strlen(month) + strlen(date) + strlen(time) +
760 strlen(year) + strlen(hostname) + strlen(hosttype) + 8;
762 printf("\n\n%s %s %s %s %s %s %s \n\n", day, month, date, time, year,
765 /* Check the first datum. If it is -1 the probe had failed */
767 sscanf(charPtr, "%s", tmpstr);
768 if (atoi(tmpstr) == -1) {
769 printf("Probe failed, no data to process.\n");
773 /* Convert the data to longs */
775 if (strcmp(hosttype, "FS") == 0)
776 numLongs = XSTAT_FS_FULLPERF_RESULTS_LEN;
777 else if (strcmp(hosttype, "CM") == 0)
778 numLongs = XSTAT_CM_FULLPERF_RESULTS_LEN;
780 fprintf(stderr, "Cannot determine hosttype %s\n", hosttype);
781 fprintf(stderr, "Skipping this entry\n");
787 for (i = 0; i < numLongs; i++) {
788 sscanf(charPtr, "%ld", longPtr);
789 sscanf(charPtr, "%s", tmpstr);
791 charPtr += strlen(tmpstr) + 1;
795 /* Verify that we read the correct number of longs and print them */
797 if (strcmp(hosttype, "CM") == 0) {
798 if (counter == XSTAT_CM_FULLPERF_RESULTS_LEN)
799 Print_cm_FullPerfInfo((struct afs_stats_CMFullPerf *)longs);
802 "Data size mismatch error. Expected %d longs, found %d longs\n",
805 if (counter == XSTAT_FS_FULLPERF_RESULTS_LEN) {
806 fsPerfP = (struct fs_stats_FullPerfStats *)longs;
807 Print_fs_OverallPerfInfo(&(fsPerfP->overall));
808 Print_fs_DetailedPerfInfo(&(fsPerfP->det));
811 "Data size mismatch error. Expected %d longs, found %d longs\n",
817 ("\n-------------------------------------------------------------------------\n");