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 *-------------------------------------------------------------------------*/
20 #include <afsconfig.h>
21 #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 *------------------------------------------------------------------------*/
102 Print_fs_OverallPerfInfo(a_ovP
)
103 struct afs_PerfStats
*a_ovP
;
105 { /*Print_fs_OverallPerfInfo */
107 printf("\t%10d numPerfCalls\n\n", a_ovP
->numPerfCalls
);
111 * Vnode cache section.
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
);
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
);
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
);
130 * Directory package section.
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
);
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
);
190 * Host module fields.
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
);
203 } /*Print_fs_OverallPerfInfo */
206 /*------------------------------------------------------------------------
210 * Print out the contents of an RPC op timing structure.
213 * a_opIdx : Index of the AFS operation we're printing number on.
214 * a_opTimeP : Ptr to the op timing structure to print.
216 *------------------------------------------------------------------------*/
219 Print_fs_OpTiming(a_opIdx
, a_opTimeP
)
221 struct fs_stats_opTimingData
*a_opTimeP
;
223 { /*Print_fs_OpTiming */
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
);
231 } /*Print_fs_OpTiming */
234 /*------------------------------------------------------------------------
235 * Print_fs_XferTiming
238 * Print out the contents of a data transfer structure.
241 * a_opIdx : Index of the AFS operation we're printing number on.
242 * a_xferP : Ptr to the data transfer structure to print.
244 *------------------------------------------------------------------------*/
247 Print_fs_XferTiming(a_opIdx
, a_xferP
)
249 struct fs_stats_xferData
*a_xferP
;
251 { /*Print_fs_XferTiming */
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
);
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]);
267 } /*Print_fs_XferTiming */
270 /*------------------------------------------------------------------------
271 * Print_fs_DetailedPerfInfo
274 * Print out a set of detailed performance numbers.
277 * a_detP : Ptr to detailed perf numbers to print.
279 *------------------------------------------------------------------------*/
282 Print_fs_DetailedPerfInfo(a_detP
)
283 struct fs_stats_DetailedStats
*a_detP
;
285 { /*Print_fs_DetailedPerfInfo */
287 int currIdx
; /*Loop variable */
289 printf("\t%10d epoch\n", a_detP
->epoch
);
291 for (currIdx
= 0; currIdx
< FS_STATS_NUM_RPC_OPS
; currIdx
++)
292 Print_fs_OpTiming(currIdx
, &(a_detP
->rpcOpTimes
[currIdx
]));
294 for (currIdx
= 0; currIdx
< FS_STATS_NUM_XFER_OPS
; currIdx
++)
295 Print_fs_XferTiming(currIdx
, &(a_detP
->xferOpTimes
[currIdx
]));
297 } /*Print_fs_DetailedPerfInfo */
300 /*------------------------------------------------------------------------
301 * Print_fs_FullPerfInfo
304 * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just
310 *------------------------------------------------------------------------*/
313 Print_fs_FullPerfInfo(a_fs_Results
)
314 struct xstat_fs_ProbeResults
*a_fs_Results
; /* ptr to fs results */
315 { /*Print_fs_FullPerfInfo */
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 */
326 code
= xstat_fs_DecodeFullPerfStats(&fullPerfP
,
327 a_fs_Results
->data
.AFS_CollData_val
,
328 a_fs_Results
->data
.AFS_CollData_len
,
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
);
337 probeTime
= a_fs_Results
->probeTime
;
338 printableTime
= ctime(&probeTime
);
339 printableTime
[strlen(printableTime
) - 1] = '\0';
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
);
346 Print_fs_OverallPerfInfo(&(fullPerfP
->overall
));
347 Print_fs_DetailedPerfInfo(&(fullPerfP
->det
));
349 } /*Print_fs_FullPerfInfo */
353 /*___________________________________________________________________________
355 *__________________________________________________________________________*/
359 /*------------------------------------------------------------------------
360 * Print_cm_UpDownStats
363 * Print the up/downtime stats for the given class of server records
367 * a_upDownP : Ptr to the server up/down info.
369 *------------------------------------------------------------------------*/
372 Print_cm_UpDownStats(a_upDownP
)
373 struct afs_stats_SrvUpDownInfo
*a_upDownP
; /*Ptr to server up/down info */
375 { /*Print_cm_UpDownStats */
378 * First, print the simple values.
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
);
396 * Now, print the array values.
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]);
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]);
415 } /*Print_cm_UpDownStats */
418 /*------------------------------------------------------------------------
419 * Print_cm_OverallPerfInfo
422 * Print out overall performance numbers.
425 * a_ovP : Ptr to the overall performance numbers.
427 *------------------------------------------------------------------------*/
430 Print_cm_OverallPerfInfo(a_ovP
)
431 struct afs_stats_CMPerf
*a_ovP
;
433 { /*Print_cm_OverallPerfInfo */
435 printf("\t%10d numPerfCalls\n", a_ovP
->numPerfCalls
);
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
);
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
);
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
);
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
);
477 printf("\t%10d sysName_ID\n", a_ovP
->sysName_ID
);
479 printf("\tFile Server up/downtimes, same cell:\n");
480 Print_cm_UpDownStats(&(a_ovP
->fs_UpDown
[0]));
482 printf("\tFile Server up/downtimes, diff cell:\n");
483 Print_cm_UpDownStats(&(a_ovP
->fs_UpDown
[1]));
485 printf("\tVL Server up/downtimes, same cell:\n");
486 Print_cm_UpDownStats(&(a_ovP
->vl_UpDown
[0]));
488 printf("\tVL Server up/downtimes, diff cell:\n");
489 Print_cm_UpDownStats(&(a_ovP
->vl_UpDown
[1]));
491 } /*Print_cm_OverallPerfInfo */
495 /*------------------------------------------------------------------------
499 * Print out the contents of an FS RPC op timing structure.
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.
506 *------------------------------------------------------------------------*/
509 Print_cm_OpTiming(a_opIdx
, a_opNames
, a_opTimeP
)
512 struct afs_stats_opTimingData
*a_opTimeP
;
514 { /*Print_cm_OpTiming */
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
);
522 } /*Print_cm_OpTiming */
525 /*------------------------------------------------------------------------
526 * Print_cm_XferTiming
529 * Print out the contents of a data transfer structure.
532 * a_opIdx : Index of the AFS operation we're printing number on.
533 * a_xferP : Ptr to the data transfer structure to print.
535 *------------------------------------------------------------------------*/
538 Print_cm_XferTiming(a_opIdx
, a_opNames
, a_xferP
)
541 struct afs_stats_xferData
*a_xferP
;
543 { /*Print_cm_XferTiming */
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
);
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]);
559 } /*Print_cm_XferTiming */
562 /*------------------------------------------------------------------------
566 * Print out the contents of an FS RPC error info structure.
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.
573 *------------------------------------------------------------------------*/
576 Print_cm_ErrInfo(a_opIdx
, a_opNames
, a_opErrP
)
579 struct afs_stats_RPCErrors
*a_opErrP
;
581 { /*Print_cm_ErrInfo */
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
);
589 } /*Print_cm_ErrInfo */
592 /*------------------------------------------------------------------------
593 * Print_cm_RPCPerfInfo
596 * Print out a set of RPC performance numbers.
599 * a_rpcP : Ptr to RPC perf numbers to print.
601 *------------------------------------------------------------------------*/
604 Print_cm_RPCPerfInfo(a_rpcP
)
605 struct afs_stats_RPCOpInfo
*a_rpcP
;
607 { /*Print_cm_RPCPerfInfo */
609 int currIdx
; /*Loop variable */
612 * Print the contents of each of the opcode-related arrays.
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
]));
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
]));
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
]));
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
]));
631 } /*Print_cm_RPCPerfInfo */
634 /*------------------------------------------------------------------------
635 * Print_cm_FullPerfInfo
638 * Print out a set of full performance numbers.
643 *------------------------------------------------------------------------*/
646 Print_cm_FullPerfInfo(a_fullP
)
647 struct afs_stats_CMFullPerf
*a_fullP
;
648 { /*Print_cm_FullPerfInfo */
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
;
661 * Print the overall numbers first, followed by all of the RPC numbers,
662 * then each of the other groupings.
664 printf("Overall Performance Info:\n-------------------------\n");
665 Print_cm_OverallPerfInfo(&(fullP
->perf
));
667 Print_cm_RPCPerfInfo(&(fullP
->rpc
));
669 authentP
= &(fullP
->authent
);
670 printf("\nAuthentication info:\n--------------------\n");
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
);
682 accessinfP
= &(fullP
->accessinf
);
683 printf("\n[Un]replicated accesses:\n------------------------\n");
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
);
690 /* There really isn't any authorship info
691 * authorP = &(fullP->author); */
693 } /*Print_cm_FullPerfInfo */
702 static char rn
[] = "main";
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],
709 struct afs_stats_CMFullPerf
*cmPerfP
;
710 struct fs_stats_FullPerfStats
*fsPerfP
;
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]);
719 "\twhere <file> is the output generated by AFSMonitor\n\n");
725 inFD
= fopen(argv
[1], "r");
726 if (inFD
== (FILE *) 0) {
727 fprintf(stderr
, "\n[ %s ] Unable to open input file %s. \n", rn
,
732 block_size
= XSTAT_CM_FULLPERF_RESULTS_LEN
* sizeof(long);
734 /* Malloc two blocks of data, one for reading each line from the data file
735 * and the other for coverting data to longs */
737 if ((line
= malloc(block_size
+ 256)) == NULL
) {
738 fprintf(stderr
, "[ %s ] malloc %d bytes failed\n", rn
,
743 if ((longs
= malloc(block_size
)) == NULL
) {
744 fprintf(stderr
, "[ %s ] malloc %d bytes failed\n", rn
, block_size
);
748 /* Parse the data file */
750 if (fgets(line
, block_size
, inFD
) == NULL
) {
754 if (strlen(line
) < 5)
757 /* Parse the date, hostname, and hosttype (FS or CM) */
760 sscanf(charPtr
, "%s %s %s %s %s %s %s", day
, month
, date
, time
, year
,
763 strlen(day
) + strlen(month
) + strlen(date
) + strlen(time
) +
764 strlen(year
) + strlen(hostname
) + strlen(hosttype
) + 8;
766 printf("\n\n%s %s %s %s %s %s %s \n\n", day
, month
, date
, time
, year
,
769 /* Check the first datum. If it is -1 the probe had failed */
771 sscanf(charPtr
, "%s", tmpstr
);
772 if (atoi(tmpstr
) == -1) {
773 printf("Probe failed, no data to process.\n");
777 /* Convert the data to longs */
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
;
784 fprintf(stderr
, "Cannot determine hosttype %s\n", hosttype
);
785 fprintf(stderr
, "Skipping this entry\n");
791 for (i
= 0; i
< numLongs
; i
++) {
792 sscanf(charPtr
, "%ld", longPtr
);
793 sscanf(charPtr
, "%s", tmpstr
);
795 charPtr
+= strlen(tmpstr
) + 1;
799 /* Verify that we read the correct number of longs and print them */
801 if (strcmp(hosttype
, "CM") == 0) {
802 if (counter
== XSTAT_CM_FULLPERF_RESULTS_LEN
)
803 Print_cm_FullPerfInfo((struct afs_stats_CMFullPerf
*)longs
);
806 "Data size mismatch error. Expected %d longs, found %d longs\n",
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
));
815 "Data size mismatch error. Expected %d longs, found %d longs\n",
821 ("\n-------------------------------------------------------------------------\n");