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>
26 #include <afs/xstat_fs.h>
27 #include <afs/xstat_cm.h>
31 /* Number of items of CM & FS statistics collected per probe.
32 These constants MUST be changed if the xstat structures are modified */
34 #define XSTAT_CM_FULLPERF_RESULTS_LEN 740
35 #define XSTAT_FS_FULLPERF_RESULTS_LEN 424
38 /* structures used by FS & CM stats print routines */
40 static char *fsOpNames[] = {
71 static char *cmOpNames[] = {
81 static char *xferOpNames[] = {
86 /*________________________________________________________________________
88 *_______________________________________________________________________*/
90 /*------------------------------------------------------------------------
91 * Print_fs_OverallPerfInfo
94 * Print out overall performance numbers.
97 * a_ovP : Ptr to the overall performance numbers.
99 *------------------------------------------------------------------------*/
101 void Print_fs_OverallPerfInfo(a_ovP)
102 struct afs_PerfStats *a_ovP;
104 { /*Print_fs_OverallPerfInfo*/
106 printf("\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls);
110 * Vnode cache section.
112 printf("\t%10d vcache_L_Entries\n", a_ovP->vcache_L_Entries);
113 printf("\t%10d vcache_L_Allocs\n", a_ovP->vcache_L_Allocs);
114 printf("\t%10d vcache_L_Gets\n", a_ovP->vcache_L_Gets);
115 printf("\t%10d vcache_L_Reads\n", a_ovP->vcache_L_Reads);
116 printf("\t%10d vcache_L_Writes\n\n",a_ovP->vcache_L_Writes);
118 printf("\t%10d vcache_S_Entries\n", a_ovP->vcache_S_Entries);
119 printf("\t%10d vcache_S_Allocs\n", a_ovP->vcache_S_Allocs);
120 printf("\t%10d vcache_S_Gets\n", a_ovP->vcache_S_Gets);
121 printf("\t%10d vcache_S_Reads\n", a_ovP->vcache_S_Reads);
122 printf("\t%10d vcache_S_Writes\n\n",a_ovP->vcache_S_Writes);
124 printf("\t%10d vcache_H_Entries\n", a_ovP->vcache_H_Entries);
125 printf("\t%10d vcache_H_Gets\n", a_ovP->vcache_H_Gets);
126 printf("\t%10d vcache_H_Replacements\n\n",a_ovP->vcache_H_Replacements);
129 * Directory package section.
131 printf("\t%10d dir_Buffers\n", a_ovP->dir_Buffers);
132 printf("\t%10d dir_Calls\n", a_ovP->dir_Calls);
133 printf("\t%10d dir_IOs\n\n", a_ovP->dir_IOs);
138 printf("\t%10d rx_packetRequests\n", a_ovP->rx_packetRequests);
139 printf("\t%10d rx_noPackets_RcvClass\n", a_ovP->rx_noPackets_RcvClass);
140 printf("\t%10d rx_noPackets_SendClass\n", a_ovP->rx_noPackets_SendClass);
141 printf("\t%10d rx_noPackets_SpecialClass\n", a_ovP->rx_noPackets_SpecialClass);
142 printf("\t%10d rx_socketGreedy\n", a_ovP->rx_socketGreedy);
143 printf("\t%10d rx_bogusPacketOnRead\n", a_ovP->rx_bogusPacketOnRead);
144 printf("\t%10d rx_bogusHost\n", a_ovP->rx_bogusHost);
145 printf("\t%10d rx_noPacketOnRead\n", a_ovP->rx_noPacketOnRead);
146 printf("\t%10d rx_noPacketBuffersOnRead\n", a_ovP->rx_noPacketBuffersOnRead);
147 printf("\t%10d rx_selects\n", a_ovP->rx_selects);
148 printf("\t%10d rx_sendSelects\n", a_ovP->rx_sendSelects);
149 printf("\t%10d rx_packetsRead_RcvClass\n", a_ovP->rx_packetsRead_RcvClass);
150 printf("\t%10d rx_packetsRead_SendClass\n", a_ovP->rx_packetsRead_SendClass);
151 printf("\t%10d rx_packetsRead_SpecialClass\n", a_ovP->rx_packetsRead_SpecialClass);
152 printf("\t%10d rx_dataPacketsRead\n", a_ovP->rx_dataPacketsRead);
153 printf("\t%10d rx_ackPacketsRead\n", a_ovP->rx_ackPacketsRead);
154 printf("\t%10d rx_dupPacketsRead\n", a_ovP->rx_dupPacketsRead);
155 printf("\t%10d rx_spuriousPacketsRead\n", a_ovP->rx_spuriousPacketsRead);
156 printf("\t%10d rx_packetsSent_RcvClass\n", a_ovP->rx_packetsSent_RcvClass);
157 printf("\t%10d rx_packetsSent_SendClass\n", a_ovP->rx_packetsSent_SendClass);
158 printf("\t%10d rx_packetsSent_SpecialClass\n", a_ovP->rx_packetsSent_SpecialClass);
159 printf("\t%10d rx_ackPacketsSent\n", a_ovP->rx_ackPacketsSent);
160 printf("\t%10d rx_pingPacketsSent\n", a_ovP->rx_pingPacketsSent);
161 printf("\t%10d rx_abortPacketsSent\n",a_ovP->rx_abortPacketsSent);
162 printf("\t%10d rx_busyPacketsSent\n", a_ovP->rx_busyPacketsSent);
163 printf("\t%10d rx_dataPacketsSent\n", a_ovP->rx_dataPacketsSent);
164 printf("\t%10d rx_dataPacketsReSent\n", a_ovP->rx_dataPacketsReSent);
165 printf("\t%10d rx_dataPacketsPushed\n", a_ovP->rx_dataPacketsPushed);
166 printf("\t%10d rx_ignoreAckedPacket\n", a_ovP->rx_ignoreAckedPacket);
167 printf("\t%10d rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec);
168 printf("\t%10d rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec);
169 printf("\t%10d rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec);
170 printf("\t%10d rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec);
171 printf("\t%10d rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec);
172 printf("\t%10d rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec);
173 printf("\t%10d rx_nRttSamples\n", a_ovP->rx_nRttSamples);
174 printf("\t%10d rx_nServerConns\n", a_ovP->rx_nServerConns);
175 printf("\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns);
176 printf("\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs);
177 printf("\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs);
178 printf("\t%10d rx_nFreeCallStructs\n\n", a_ovP->rx_nFreeCallStructs);
181 * Host module fields.
183 printf("\t%10d host_NumHostEntries\n", a_ovP->host_NumHostEntries);
184 printf("\t%10d host_HostBlocks\n", a_ovP->host_HostBlocks);
185 printf("\t%10d host_NonDeletedHosts\n", a_ovP->host_NonDeletedHosts);
186 printf("\t%10d host_HostsInSameNetOrSubnet\n", a_ovP->host_HostsInSameNetOrSubnet);
187 printf("\t%10d host_HostsInDiffSubnet\n", a_ovP->host_HostsInDiffSubnet);
188 printf("\t%10d host_HostsInDiffNetwork\n",a_ovP->host_HostsInDiffNetwork);
189 printf("\t%10d host_NumClients\n", a_ovP->host_NumClients);
190 printf("\t%10d host_ClientBlocks\n\n", a_ovP->host_ClientBlocks);
192 } /*Print_fs_OverallPerfInfo*/
195 /*------------------------------------------------------------------------
199 * Print out the contents of an RPC op timing structure.
202 * a_opIdx : Index of the AFS operation we're printing number on.
203 * a_opTimeP : Ptr to the op timing structure to print.
205 *------------------------------------------------------------------------*/
207 void Print_fs_OpTiming(a_opIdx, a_opTimeP)
209 struct fs_stats_opTimingData *a_opTimeP;
211 { /*Print_fs_OpTiming*/
213 printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
215 a_opTimeP->numOps, a_opTimeP->numSuccesses,
216 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
217 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
218 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
220 } /*Print_fs_OpTiming*/
223 /*------------------------------------------------------------------------
224 * Print_fs_XferTiming
227 * Print out the contents of a data transfer structure.
230 * a_opIdx : Index of the AFS operation we're printing number on.
231 * a_xferP : Ptr to the data transfer structure to print.
233 *------------------------------------------------------------------------*/
235 void Print_fs_XferTiming(a_opIdx, a_xferP)
237 struct fs_stats_xferData *a_xferP;
239 { /*Print_fs_XferTiming*/
241 printf("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
242 xferOpNames[a_opIdx],
243 a_xferP->numXfers, a_xferP->numSuccesses,
244 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
245 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
246 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
247 printf("\t[bytes: sum=%d, min=%d, max=%d]\n",
248 a_xferP->sumBytes, a_xferP->minBytes, a_xferP->maxBytes);
249 printf("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d 7:%d 8:%d]\n",
260 } /*Print_fs_XferTiming*/
263 /*------------------------------------------------------------------------
264 * Print_fs_DetailedPerfInfo
267 * Print out a set of detailed performance numbers.
270 * a_detP : Ptr to detailed perf numbers to print.
272 *------------------------------------------------------------------------*/
274 void Print_fs_DetailedPerfInfo(a_detP)
275 struct fs_stats_DetailedStats *a_detP;
277 { /*Print_fs_DetailedPerfInfo*/
279 int currIdx; /*Loop variable*/
281 printf("\t%10d epoch\n", a_detP->epoch);
283 for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
284 Print_fs_OpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]));
286 for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
287 Print_fs_XferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]));
289 } /*Print_fs_DetailedPerfInfo*/
292 /*------------------------------------------------------------------------
293 * Print_fs_FullPerfInfo
296 * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just
302 *------------------------------------------------------------------------*/
304 void Print_fs_FullPerfInfo(a_fs_Results)
305 struct xstat_fs_ProbeResults *a_fs_Results; /* ptr to fs results */
306 { /*Print_fs_FullPerfInfo*/
308 static char rn[] = "Print_fs_FullPerfInfo"; /*Routine name*/
309 static long fullPerfLongs =
310 (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # longs to rcv*/
311 long numLongs; /*# longwords received*/
312 struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats*/
313 char *printableTime; /*Ptr to printable time string*/
316 numLongs = a_fs_Results->data.AFS_CollData_len;
317 if (numLongs != fullPerfLongs) {
318 printf(" ** Data size mismatch in full performance collection!\n");
319 printf(" ** Expecting %d, got %d\n", fullPerfLongs, numLongs);
323 printableTime = ctime(&(a_fs_Results->probeTime));
324 printableTime[strlen(printableTime)-1] = '\0';
325 fullPerfP = (struct fs_stats_FullPerfStats *)
326 (a_fs_Results->data.AFS_CollData_val);
328 printf("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
329 a_fs_Results->collectionNumber,
330 a_fs_Results->connP->hostName,
331 a_fs_Results->probeNum,
334 Print_fs_OverallPerfInfo(&(fullPerfP->overall));
335 Print_fs_DetailedPerfInfo(&(fullPerfP->det));
337 } /*Print_fs_FullPerfInfo*/
341 /*___________________________________________________________________________
343 *__________________________________________________________________________*/
347 /*------------------------------------------------------------------------
348 * Print_cm_UpDownStats
351 * Print the up/downtime stats for the given class of server records
355 * a_upDownP : Ptr to the server up/down info.
357 *------------------------------------------------------------------------*/
359 void Print_cm_UpDownStats(a_upDownP)
360 struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info*/
362 { /*Print_cm_UpDownStats*/
365 * First, print the simple values.
367 printf("\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
368 printf("\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
369 printf("\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
370 printf("\t\t%10d sumOfRecordAges\n", a_upDownP->sumOfRecordAges);
371 printf("\t\t%10d ageOfYoungestRecord\n", a_upDownP->ageOfYoungestRecord);
372 printf("\t\t%10d ageOfOldestRecord\n", a_upDownP->ageOfOldestRecord);
373 printf("\t\t%10d numDowntimeIncidents\n", a_upDownP->numDowntimeIncidents);
374 printf("\t\t%10d numRecordsNeverDown\n", a_upDownP->numRecordsNeverDown);
375 printf("\t\t%10d maxDowntimesInARecord\n", a_upDownP->maxDowntimesInARecord);
376 printf("\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
377 printf("\t\t%10d shortestDowntime\n", a_upDownP->shortestDowntime);
378 printf("\t\t%10d longestDowntime\n", a_upDownP->longestDowntime);
381 * Now, print the array values.
383 printf("\t\tDowntime duration distribution:\n");
384 printf("\t\t\t%8d: 0 min .. 10 min\n", a_upDownP->downDurations[0]);
385 printf("\t\t\t%8d: 10 min .. 30 min\n", a_upDownP->downDurations[1]);
386 printf("\t\t\t%8d: 30 min .. 1 hr\n", a_upDownP->downDurations[2]);
387 printf("\t\t\t%8d: 1 hr .. 2 hr\n", a_upDownP->downDurations[3]);
388 printf("\t\t\t%8d: 2 hr .. 4 hr\n", a_upDownP->downDurations[4]);
389 printf("\t\t\t%8d: 4 hr .. 8 hr\n", a_upDownP->downDurations[5]);
390 printf("\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
392 printf("\t\tDowntime incident distribution:\n");
393 printf("\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
394 printf("\t\t\t%8d: 1 time\n", a_upDownP->downIncidents[1]);
395 printf("\t\t\t%8d: 2 .. 5 times\n", a_upDownP->downIncidents[2]);
396 printf("\t\t\t%8d: 6 .. 10 times\n", a_upDownP->downIncidents[3]);
397 printf("\t\t\t%8d: 10 .. 50 times\n", a_upDownP->downIncidents[4]);
398 printf("\t\t\t%8d: > 50 times\n", a_upDownP->downIncidents[5]);
400 } /*Print_cm_UpDownStats*/
403 /*------------------------------------------------------------------------
404 * Print_cm_OverallPerfInfo
407 * Print out overall performance numbers.
410 * a_ovP : Ptr to the overall performance numbers.
412 *------------------------------------------------------------------------*/
414 void Print_cm_OverallPerfInfo(a_ovP)
415 struct afs_stats_CMPerf *a_ovP;
417 { /*Print_cm_OverallPerfInfo*/
419 printf("\t%10d numPerfCalls\n", a_ovP->numPerfCalls);
421 printf("\t%10d epoch\n", a_ovP->epoch);
422 printf("\t%10d numCellsVisible\n", a_ovP->numCellsVisible);
423 printf("\t%10d numCellsContacted\n", a_ovP->numCellsContacted);
424 printf("\t%10d dlocalAccesses\n", a_ovP->dlocalAccesses);
425 printf("\t%10d vlocalAccesses\n", a_ovP->vlocalAccesses);
426 printf("\t%10d dremoteAccesses\n", a_ovP->dremoteAccesses);
427 printf("\t%10d vremoteAccesses\n", a_ovP->vremoteAccesses);
428 printf("\t%10d cacheNumEntries\n", a_ovP->cacheNumEntries);
429 printf("\t%10d cacheBlocksTotal\n", a_ovP->cacheBlocksTotal);
430 printf("\t%10d cacheBlocksInUse\n", a_ovP->cacheBlocksInUse);
431 printf("\t%10d cacheBlocksOrig\n", a_ovP->cacheBlocksOrig);
432 printf("\t%10d cacheMaxDirtyChunks\n",a_ovP->cacheMaxDirtyChunks);
433 printf("\t%10d cacheCurrDirtyChunks\n", a_ovP->cacheCurrDirtyChunks);
434 printf("\t%10d dcacheHits\n", a_ovP->dcacheHits);
435 printf("\t%10d vcacheHits\n", a_ovP->vcacheHits);
436 printf("\t%10d dcacheMisses\n", a_ovP->dcacheMisses);
437 printf("\t%10d vcacheMisses\n", a_ovP->vcacheMisses);
438 printf("\t%10d cacheFilesReused\n", a_ovP->cacheFilesReused);
439 printf("\t%10d vcacheXAllocs\n", a_ovP->vcacheXAllocs);
441 printf("\t%10d bufAlloced\n", a_ovP->bufAlloced);
442 printf("\t%10d bufHits\n", a_ovP->bufHits);
443 printf("\t%10d bufMisses\n", a_ovP->bufMisses);
444 printf("\t%10d bufFlushDirty\n", a_ovP->bufFlushDirty);
446 printf("\t%10d LargeBlocksActive\n", a_ovP->LargeBlocksActive);
447 printf("\t%10d LargeBlocksAlloced\n", a_ovP->LargeBlocksAlloced);
448 printf("\t%10d SmallBlocksActive\n", a_ovP->SmallBlocksActive);
449 printf("\t%10d SmallBlocksAlloced\n", a_ovP->SmallBlocksAlloced);
450 printf("\t%10d OutStandingMemUsage\n", a_ovP->OutStandingMemUsage);
451 printf("\t%10d OutStandingAllocs\n", a_ovP->OutStandingAllocs);
452 printf("\t%10d CallBackAlloced\n", a_ovP->CallBackAlloced);
453 printf("\t%10d CallBackFlushes\n", a_ovP->CallBackFlushes);
455 printf("\t%10d srvRecords\n", a_ovP->srvRecords);
456 printf("\t%10d srvNumBuckets\n", a_ovP->srvNumBuckets);
457 printf("\t%10d srvMaxChainLength\n", a_ovP->srvMaxChainLength);
458 printf("\t%10d srvMaxChainLengthHWM\n", a_ovP->srvMaxChainLengthHWM);
459 printf("\t%10d srvRecordsHWM\n", a_ovP->srvRecordsHWM);
461 printf("\t%10d sysName_ID\n", a_ovP->sysName_ID);
463 printf("\tFile Server up/downtimes, same cell:\n");
464 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[0]));
466 printf("\tFile Server up/downtimes, diff cell:\n");
467 Print_cm_UpDownStats(&(a_ovP->fs_UpDown[1]));
469 printf("\tVL Server up/downtimes, same cell:\n");
470 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[0]));
472 printf("\tVL Server up/downtimes, diff cell:\n");
473 Print_cm_UpDownStats(&(a_ovP->vl_UpDown[1]));
475 } /*Print_cm_OverallPerfInfo*/
479 /*------------------------------------------------------------------------
483 * Print out the contents of an FS RPC op timing structure.
486 * a_opIdx : Index of the AFS operation we're printing number on.
487 * a_opNames : Ptr to table of operaton names.
488 * a_opTimeP : Ptr to the op timing structure to print.
490 *------------------------------------------------------------------------*/
492 void Print_cm_OpTiming(a_opIdx, a_opNames, a_opTimeP)
495 struct afs_stats_opTimingData *a_opTimeP;
497 { /*Print_cm_OpTiming*/
499 printf("%15s: %d ops (%d OK); sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
501 a_opTimeP->numOps, a_opTimeP->numSuccesses,
502 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
503 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
504 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
506 } /*Print_cm_OpTiming*/
509 /*------------------------------------------------------------------------
510 * Print_cm_XferTiming
513 * Print out the contents of a data transfer structure.
516 * a_opIdx : Index of the AFS operation we're printing number on.
517 * a_xferP : Ptr to the data transfer structure to print.
519 *------------------------------------------------------------------------*/
521 void Print_cm_XferTiming(a_opIdx, a_opNames, a_xferP)
524 struct afs_stats_xferData *a_xferP;
526 { /*Print_cm_XferTiming*/
528 printf("%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
530 a_xferP->numXfers, a_xferP->numSuccesses,
531 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
532 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
533 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
534 printf("\t[bytes: sum=%d, min=%d, max=%d]\n",
535 a_xferP->sumBytes, a_xferP->minBytes, a_xferP->maxBytes);
536 printf("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d, 7: %d, 8: %d]\n",
547 } /*Print_cm_XferTiming*/
550 /*------------------------------------------------------------------------
554 * Print out the contents of an FS RPC error info structure.
557 * a_opIdx : Index of the AFS operation we're printing.
558 * a_opNames : Ptr to table of operation names.
559 * a_opErrP : Ptr to the op timing structure to print.
561 *------------------------------------------------------------------------*/
563 void Print_cm_ErrInfo(a_opIdx, a_opNames, a_opErrP)
566 struct afs_stats_RPCErrors *a_opErrP;
568 { /*Print_cm_ErrInfo*/
570 printf("%15s: %d server, %d network, %d prot, %d vol, %d busies, %d other\n",
572 a_opErrP->err_Server,
573 a_opErrP->err_Network,
574 a_opErrP->err_Protection,
575 a_opErrP->err_Volume,
576 a_opErrP->err_VolumeBusies,
577 a_opErrP->err_Other);
579 } /*Print_cm_ErrInfo*/
582 /*------------------------------------------------------------------------
583 * Print_cm_RPCPerfInfo
586 * Print out a set of RPC performance numbers.
589 * a_rpcP : Ptr to RPC perf numbers to print.
591 *------------------------------------------------------------------------*/
593 void Print_cm_RPCPerfInfo(a_rpcP)
594 struct afs_stats_RPCOpInfo *a_rpcP;
596 { /*Print_cm_RPCPerfInfo*/
598 int currIdx; /*Loop variable*/
601 * Print the contents of each of the opcode-related arrays.
603 printf("FS Operation Timings:\n---------------------\n");
604 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
605 Print_cm_OpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx]));
607 printf("\nError Info:\n-----------\n");
608 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
609 Print_cm_ErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx]));
611 printf("\nTransfer timings:\n-----------------\n");
612 for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++)
613 Print_cm_XferTiming(currIdx, xferOpNames, &(a_rpcP->fsXferTimes[currIdx]));
615 printf("\nCM Operation Timings:\n---------------------\n");
616 for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
617 Print_cm_OpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]));
619 } /*Print_cm_RPCPerfInfo*/
622 /*------------------------------------------------------------------------
623 * Print_cm_FullPerfInfo
626 * Print out a set of full performance numbers.
631 *------------------------------------------------------------------------*/
633 void Print_cm_FullPerfInfo(a_fullP)
634 struct afs_stats_CMFullPerf *a_fullP;
635 { /*Print_cm_FullPerfInfo*/
637 static char rn[] = "Print_cm_FullPerfInfo"; /* routine name */
638 struct afs_stats_AuthentInfo *authentP; /*Ptr to authentication stats*/
639 struct afs_stats_AccessInfo *accessinfP; /*Ptr to access stats*/
640 struct afs_stats_AuthorInfo *authorP; /*Ptr to authorship stats*/
641 static long fullPerfLongs =
642 (sizeof (struct afs_stats_CMFullPerf) >> 2); /*Correct #longs*/
643 long numLongs; /*# longs actually received*/
644 struct afs_stats_CMFullPerf *fullP;
649 * Print the overall numbers first, followed by all of the RPC numbers,
650 * then each of the other groupings.
652 printf("Overall Performance Info:\n-------------------------\n");
653 Print_cm_OverallPerfInfo(&(fullP->perf));
655 Print_cm_RPCPerfInfo(&(fullP->rpc));
657 authentP = &(fullP->authent);
658 printf("\nAuthentication info:\n--------------------\n");
659 printf("\t%d PAGS, %d records (%d auth, %d unauth), %d max in PAG, chain max: %d\n",
661 authentP->curr_Records,
662 authentP->curr_AuthRecords,
663 authentP->curr_UnauthRecords,
664 authentP->curr_MaxRecordsInPAG,
665 authentP->curr_LongestChain);
666 printf("\t%d PAG creations, %d tkt updates\n",
667 authentP->PAGCreations,
668 authentP->TicketUpdates);
669 printf("\t[HWMs: %d PAGS, %d records, %d max in PAG, chain max: %d]\n",
671 authentP->HWM_Records,
672 authentP->HWM_MaxRecordsInPAG,
673 authentP->HWM_LongestChain);
675 accessinfP = &(fullP->accessinf);
676 printf("\n[Un]replicated accesses:\n------------------------\n");
677 printf("\t%d unrep, %d rep, %d reps accessed, %d max reps/ref, %d first OK\n\n",
678 accessinfP->unreplicatedRefs,
679 accessinfP->replicatedRefs,
680 accessinfP->numReplicasAccessed,
681 accessinfP->maxReplicasPerRef,
682 accessinfP->refFirstReplicaOK);
684 /* There really isn't any authorship info
685 authorP = &(fullP->author); */
687 } /*Print_cm_FullPerfInfo*/
696 static char rn[] = "main";
698 char *line, *charPtr;
699 long *longs, *longPtr;
700 int block_size, exitcode, i, numLongs, counter;
701 char day[5],month[5],date[5],time[10],year[5],hostname[80],hosttype[5];
702 struct afs_stats_CMFullPerf *cmPerfP;
703 struct fs_stats_FullPerfStats *fsPerfP;
707 if ((argc < 2) || (strcasecmp(argv[1],"-h")==0) ||
708 (strcasecmp(argv[1],"-help")==0) || (strcasecmp(argv[1],"help")==0) ) {
709 fprintf(stderr,"\nUsage: %s <file>\n",argv[0]);
710 fprintf(stderr,"\twhere <file> is the output generated by AFSMonitor\n\n");
716 inFD = fopen(argv[1],"r");
717 if (inFD == (FILE *)0) {
718 fprintf(stderr,"\n[ %s ] Unable to open input file %s. \n",rn,argv[1]);
722 block_size = XSTAT_CM_FULLPERF_RESULTS_LEN * sizeof(long);
724 /* Malloc two blocks of data, one for reading each line from the data file
725 and the other for coverting data to longs */
727 if ( (line = malloc(block_size+256)) == (char *)NULL) {
728 fprintf(stderr,"[ %s ] malloc %d bytes failed\n",rn,block_size+256);
732 if ( (longs = malloc(block_size)) == (long *) NULL) {
733 fprintf(stderr,"[ %s ] malloc %d bytes failed\n",rn,block_size);
737 /* Parse the data file */
739 if (fgets(line, block_size, inFD) == NULL) {
743 if (strlen(line) < 5)
746 /* Parse the date, hostname, and hosttype (FS or CM) */
749 sscanf(charPtr,"%s %s %s %s %s %s %s", day,month,date,time,
750 year,hostname,hosttype);
751 charPtr += strlen(day) + strlen(month) + strlen(date) + strlen(time) +
752 strlen(year) + strlen(hostname) + strlen(hosttype) + 8;
754 printf("\n\n%s %s %s %s %s %s %s \n\n",
755 day,month,date,time,year,hostname, hosttype);
757 /* Check the first datum. If it is -1 the probe had failed */
759 sscanf(charPtr,"%s",tmpstr);
760 if ( atoi(tmpstr) == -1) {
761 printf("Probe failed, no data to process.\n");
765 /* Convert the data to longs */
767 if (strcmp(hosttype,"FS") == 0) numLongs = XSTAT_FS_FULLPERF_RESULTS_LEN;
768 else if (strcmp(hosttype,"CM") == 0) numLongs=XSTAT_CM_FULLPERF_RESULTS_LEN;
770 fprintf(stderr, "Cannot determine hosttype %s\n",hosttype);
771 fprintf(stderr,"Skipping this entry\n");
777 for (i = 0; i < numLongs; i++) {
778 sscanf(charPtr,"%ld",longPtr);
779 sscanf(charPtr,"%s",tmpstr);
781 charPtr += strlen(tmpstr) + 1;
785 /* Verify that we read the correct number of longs and print them */
787 if (strcmp(hosttype,"CM") == 0) {
788 if (counter == XSTAT_CM_FULLPERF_RESULTS_LEN)
789 Print_cm_FullPerfInfo( (struct afs_stats_CMFullPerf *) longs);
791 fprintf(stderr,"Data size mismatch error. Expected %d longs, found %d longs\n",numLongs,counter);
794 if (counter == XSTAT_FS_FULLPERF_RESULTS_LEN) {
795 fsPerfP = (struct fs_stats_FullPerfStats *) longs;
796 Print_fs_OverallPerfInfo (&(fsPerfP->overall));
797 Print_fs_DetailedPerfInfo (&(fsPerfP->det));
800 fprintf(stderr,"Data size mismatch error. Expected %d longs, found %d longs\n",numLongs,counter);
804 printf("\n-------------------------------------------------------------------------\n");