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 probeTime = a_fs_Results->probeTime;
333 printableTime = ctime(&probeTime);
334 printableTime[strlen(printableTime) - 1] = '\0';
335 fullPerfP = (struct fs_stats_FullPerfStats *)
336 (a_fs_Results->data.AFS_CollData_val);
339 ("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
340 a_fs_Results->collectionNumber, a_fs_Results->connP->hostName,
341 a_fs_Results->probeNum, printableTime);
343 Print_fs_OverallPerfInfo(&(fullPerfP->overall));
344 Print_fs_DetailedPerfInfo(&(fullPerfP->det));
346 } /*Print_fs_FullPerfInfo */
350 /*___________________________________________________________________________
352 *__________________________________________________________________________*/
356 /*------------------------------------------------------------------------
357 * Print_cm_UpDownStats
360 * Print the up/downtime stats for the given class of server records
364 * a_upDownP : Ptr to the server up/down info.
366 *------------------------------------------------------------------------*/
369 Print_cm_UpDownStats(a_upDownP)
370 struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */
372 { /*Print_cm_UpDownStats */
375 * First, print the simple values.
377 printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
378 printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
379 printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
380 printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
381 printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
382 printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
383 printf("\t\t%10d numDowntimeIncidents\n",
384 a_upDownP->numDowntimeIncidents);
385 printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
386 printf("\t\t%10d maxDowntimesInARecord\n",
387 a_upDownP->maxDowntimesInARecord);
388 printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
389 printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
390 printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
393 * Now, print the array values.
395 printf("\t\tDowntime duration distribution:\n");
396 printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
397 printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
398 printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
399 printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
400 printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
401 printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
402 printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
404 printf("\t\tDowntime incident distribution:\n");
405 printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
406 printf("\t\t\t%8d: 1 time\n", a_upDownP->downIncidents[1]);
407 printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downIncidents[2]);
408 printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downIncidents[3]);
409 printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downIncidents[4]);
410 printf("\t\t\t%8d: > 50 times\n", a_upDownP->downIncidents[5]);
412 } /*Print_cm_UpDownStats */
415 /*------------------------------------------------------------------------
416 * Print_cm_OverallPerfInfo
419 * Print out overall performance numbers.
422 * a_ovP : Ptr to the overall performance numbers.
424 *------------------------------------------------------------------------*/
427 Print_cm_OverallPerfInfo(a_ovP)
428 struct afs_stats_CMPerf *a_ovP;
430 { /*Print_cm_OverallPerfInfo */
432 printf("\t%10d numPerfCalls\n", a_ovP->numPerfCalls);
434 printf("\t%10d epoch\n", a_ovP->epoch);
435 printf("\t%10d numCellsVisible\n", a_ovP->numCellsVisible);
436 printf("\t%10d numCellsContacted\n", a_ovP->numCellsContacted);
437 printf("\t%10d dlocalAccesses\n", a_ovP->dlocalAccesses);
438 printf("\t%10d vlocalAccesses\n", a_ovP->vlocalAccesses);
439 printf("\t%10d dremoteAccesses\n", a_ovP->dremoteAccesses);
440 printf("\t%10d vremoteAccesses\n", a_ovP->vremoteAccesses);
441 printf("\t%10d cacheNumEntries\n", a_ovP->cacheNumEntries);
442 printf("\t%10d cacheBlocksTotal\n", a_ovP->cacheBlocksTotal);
443 printf("\t%10d cacheBlocksInUse\n", a_ovP->cacheBlocksInUse);
444 printf("\t%10d cacheBlocksOrig\n", a_ovP->cacheBlocksOrig);
445 printf("\t%10d cacheMaxDirtyChunks\n", a_ovP->cacheMaxDirtyChunks);
446 printf("\t%10d cacheCurrDirtyChunks\n", a_ovP->cacheCurrDirtyChunks);
447 printf("\t%10d dcacheHits\n", a_ovP->dcacheHits);
448 printf("\t%10d vcacheHits\n", a_ovP->vcacheHits);
449 printf("\t%10d dcacheMisses\n", a_ovP->dcacheMisses);
450 printf("\t%10d vcacheMisses\n", a_ovP->vcacheMisses);
451 printf("\t%10d cacheFilesReused\n", a_ovP->cacheFilesReused);
452 printf("\t%10d vcacheXAllocs\n", a_ovP->vcacheXAllocs);
454 printf("\t%10d bufAlloced\n", a_ovP->bufAlloced);
455 printf("\t%10d bufHits\n", a_ovP->bufHits);
456 printf("\t%10d bufMisses\n", a_ovP->bufMisses);
457 printf("\t%10d bufFlushDirty\n", a_ovP->bufFlushDirty);
459 printf("\t%10d LargeBlocksActive\n", a_ovP->LargeBlocksActive);
460 printf("\t%10d LargeBlocksAlloced\n", a_ovP->LargeBlocksAlloced);
461 printf("\t%10d SmallBlocksActive\n", a_ovP->SmallBlocksActive);
462 printf("\t%10d SmallBlocksAlloced\n", a_ovP->SmallBlocksAlloced);
463 printf("\t%10d OutStandingMemUsage\n", a_ovP->OutStandingMemUsage);
464 printf("\t%10d OutStandingAllocs\n", a_ovP->OutStandingAllocs);
465 printf("\t%10d CallBackAlloced\n", a_ovP->CallBackAlloced);
466 printf("\t%10d CallBackFlushes\n", a_ovP->CallBackFlushes);
468 printf("\t%10d srvRecords\n", a_ovP->srvRecords);
469 printf("\t%10d srvNumBuckets\n", a_ovP->srvNumBuckets);
470 printf("\t%10d srvMaxChainLength\n", a_ovP->srvMaxChainLength);
471 printf("\t%10d srvMaxChainLengthHWM\n", a_ovP->srvMaxChainLengthHWM);
472 printf("\t%10d srvRecordsHWM\n", a_ovP->srvRecordsHWM);
474 printf("\t%10d sysName_ID\n", a_ovP->sysName_ID);
476 printf("\tFile Server up/downtimes, same cell:\n");
477 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[0]));
479 printf("\tFile Server up/downtimes, diff cell:\n");
480 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[1]));
482 printf("\tVL Server up/downtimes, same cell:\n");
483 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[0]));
485 printf("\tVL Server up/downtimes, diff cell:\n");
486 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[1]));
488 } /*Print_cm_OverallPerfInfo */
492 /*------------------------------------------------------------------------
496 * Print out the contents of an FS RPC op timing structure.
499 * a_opIdx : Index of the AFS operation we're printing number on.
500 * a_opNames : Ptr to table of operaton names.
501 * a_opTimeP : Ptr to the op timing structure to print.
503 *------------------------------------------------------------------------*/
506 Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP)
509 struct afs_stats_opTimingData *a_opTimeP;
511 { /*Print_cm_OpTiming */
513 printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
514 a_opNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
515 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
516 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
517 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
519 } /*Print_cm_OpTiming */
522 /*------------------------------------------------------------------------
523 * Print_cm_XferTiming
526 * Print out the contents of a data transfer structure.
529 * a_opIdx : Index of the AFS operation we're printing number on.
530 * a_xferP : Ptr to the data transfer structure to print.
532 *------------------------------------------------------------------------*/
535 Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP)
538 struct afs_stats_xferData *a_xferP;
540 { /*Print_cm_XferTiming */
543 ("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
544 a_opNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
545 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
546 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
547 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
548 printf("\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes,
549 a_xferP->minBytes, a_xferP->maxBytes);
551 ("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d, 7: %d, 8: %d]\n",
552 a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
553 a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
554 a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);
556 } /*Print_cm_XferTiming */
559 /*------------------------------------------------------------------------
563 * Print out the contents of an FS RPC error info structure.
566 * a_opIdx : Index of the AFS operation we're printing.
567 * a_opNames : Ptr to table of operation names.
568 * a_opErrP : Ptr to the op timing structure to print.
570 *------------------------------------------------------------------------*/
573 Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP)
576 struct afs_stats_RPCErrors *a_opErrP;
578 { /*Print_cm_ErrInfo */
581 ("%15s: %d server, %d network, %d prot, %d vol, %d busies, %d other\n",
582 a_opNames[a_opIdx], a_opErrP->err_Server, a_opErrP->err_Network,
583 a_opErrP->err_Protection, a_opErrP->err_Volume,
584 a_opErrP->err_VolumeBusies, a_opErrP->err_Other);
586 } /*Print_cm_ErrInfo */
589 /*------------------------------------------------------------------------
590 * Print_cm_RPCPerfInfo
593 * Print out a set of RPC performance numbers.
596 * a_rpcP : Ptr to RPC perf numbers to print.
598 *------------------------------------------------------------------------*/
601 Print_cm_RPCPerfInfo(a_rpcP)
602 struct afs_stats_RPCOpInfo *a_rpcP;
604 { /*Print_cm_RPCPerfInfo */
606 int currIdx; /*Loop variable */
609 * Print the contents of each of the opcode-related arrays.
611 printf("FS Operation Timings:\n---------------------\n");
612 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
613 Print_cm_OpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx]));
615 printf("\nError Info:\n-----------\n");
616 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
617 Print_cm_ErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx]));
619 printf("\nTransfer timings:\n-----------------\n");
620 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++)
621 Print_cm_XferTiming(currIdx, xferOpNames,
622 &(a_rpcP->fsXferTimes[currIdx]));
624 printf("\nCM Operation Timings:\n---------------------\n");
625 for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
626 Print_cm_OpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]));
628 } /*Print_cm_RPCPerfInfo */
631 /*------------------------------------------------------------------------
632 * Print_cm_FullPerfInfo
635 * Print out a set of full performance numbers.
640 *------------------------------------------------------------------------*/
643 Print_cm_FullPerfInfo(a_fullP)
644 struct afs_stats_CMFullPerf *a_fullP;
645 { /*Print_cm_FullPerfInfo */
647 static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */
648 struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats */
649 struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats */
650 struct afs_stats_AuthorInfo *authorP; /*Ptr to authorship stats */
651 static long fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2); /*Correct #longs */
652 long numLongs; /*# longs actually received */
653 struct afs_stats_CMFullPerf *fullP;
658 * Print the overall numbers first, followed by all of the RPC numbers,
659 * then each of the other groupings.
661 printf("Overall Performance Info:\n-------------------------\n");
662 Print_cm_OverallPerfInfo(&(fullP->perf));
664 Print_cm_RPCPerfInfo(&(fullP->rpc));
666 authentP = &(fullP->authent);
667 printf("\nAuthentication info:\n--------------------\n");
669 ("\t%d PAGS, %d records (%d auth, %d unauth), %d max in PAG, chain max: %d\n",
670 authentP->curr_PAGs, authentP->curr_Records,
671 authentP->curr_AuthRecords, authentP->curr_UnauthRecords,
672 authentP->curr_MaxRecordsInPAG, authentP->curr_LongestChain);
673 printf("\t%d PAG creations, %d tkt updates\n", authentP->PAGCreations,
674 authentP->TicketUpdates);
675 printf("\t[HWMs: %d PAGS, %d records, %d max in PAG, chain max: %d]\n",
676 authentP->HWM_PAGs, authentP->HWM_Records,
677 authentP->HWM_MaxRecordsInPAG, authentP->HWM_LongestChain);
679 accessinfP = &(fullP->accessinf);
680 printf("\n[Un]replicated accesses:\n------------------------\n");
682 ("\t%d unrep, %d rep, %d reps accessed, %d max reps/ref, %d first OK\n\n",
683 accessinfP->unreplicatedRefs, accessinfP->replicatedRefs,
684 accessinfP->numReplicasAccessed, accessinfP->maxReplicasPerRef,
685 accessinfP->refFirstReplicaOK);
687 /* There really isn't any authorship info
688 * authorP = &(fullP->author); */
690 } /*Print_cm_FullPerfInfo */
699 static char rn[] = "main";
701 char *line, *charPtr;
702 long *longs, *longPtr;
703 int block_size, exitcode, i, numLongs, counter;
704 char day[5], month[5], date[5], time[10], year[5], hostname[80],
706 struct afs_stats_CMFullPerf *cmPerfP;
707 struct fs_stats_FullPerfStats *fsPerfP;
711 if ((argc < 2) || (strcasecmp(argv[1], "-h") == 0)
712 || (strcasecmp(argv[1], "-help") == 0)
713 || (strcasecmp(argv[1], "help") == 0)) {
714 fprintf(stderr, "\nUsage: %s <file>\n", argv[0]);
716 "\twhere <file> is the output generated by AFSMonitor\n\n");
722 inFD = fopen(argv[1], "r");
723 if (inFD == (FILE *) 0) {
724 fprintf(stderr, "\n[ %s ] Unable to open input file %s. \n", rn,
729 block_size = XSTAT_CM_FULLPERF_RESULTS_LEN * sizeof(long);
731 /* Malloc two blocks of data, one for reading each line from the data file
732 * and the other for coverting data to longs */
734 if ((line = malloc(block_size + 256)) == (char *)NULL) {
735 fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn,
740 if ((longs = malloc(block_size)) == (long *)NULL) {
741 fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn, block_size);
745 /* Parse the data file */
747 if (fgets(line, block_size, inFD) == NULL) {
751 if (strlen(line) < 5)
754 /* Parse the date, hostname, and hosttype (FS or CM) */
757 sscanf(charPtr, "%s %s %s %s %s %s %s", day, month, date, time, year,
760 strlen(day) + strlen(month) + strlen(date) + strlen(time) +
761 strlen(year) + strlen(hostname) + strlen(hosttype) + 8;
763 printf("\n\n%s %s %s %s %s %s %s \n\n", day, month, date, time, year,
766 /* Check the first datum. If it is -1 the probe had failed */
768 sscanf(charPtr, "%s", tmpstr);
769 if (atoi(tmpstr) == -1) {
770 printf("Probe failed, no data to process.\n");
774 /* Convert the data to longs */
776 if (strcmp(hosttype, "FS") == 0)
777 numLongs = XSTAT_FS_FULLPERF_RESULTS_LEN;
778 else if (strcmp(hosttype, "CM") == 0)
779 numLongs = XSTAT_CM_FULLPERF_RESULTS_LEN;
781 fprintf(stderr, "Cannot determine hosttype %s\n", hosttype);
782 fprintf(stderr, "Skipping this entry\n");
788 for (i = 0; i < numLongs; i++) {
789 sscanf(charPtr, "%ld", longPtr);
790 sscanf(charPtr, "%s", tmpstr);
792 charPtr += strlen(tmpstr) + 1;
796 /* Verify that we read the correct number of longs and print them */
798 if (strcmp(hosttype, "CM") == 0) {
799 if (counter == XSTAT_CM_FULLPERF_RESULTS_LEN)
800 Print_cm_FullPerfInfo((struct afs_stats_CMFullPerf *)longs);
803 "Data size mismatch error. Expected %d longs, found %d longs\n",
806 if (counter == XSTAT_FS_FULLPERF_RESULTS_LEN) {
807 fsPerfP = (struct fs_stats_FullPerfStats *)longs;
808 Print_fs_OverallPerfInfo(&(fsPerfP->overall));
809 Print_fs_DetailedPerfInfo(&(fsPerfP->det));
812 "Data size mismatch error. Expected %d longs, found %d longs\n",
818 ("\n-------------------------------------------------------------------------\n");