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
12 * Test of the xstat_fs module.
14 *------------------------------------------------------------------------*/
16 #include <afsconfig.h>
17 #include <afs/param.h>
20 #include "xstat_fs.h" /*Interface for xstat_fs module */
21 #include <afs/cmd.h> /*Command line interpreter */
24 #include <afs/afsutil.h>
27 * Command line parameter indices.
28 * P_FS_NAMES : List of FileServer names.
29 * P_COLL_IDS : List of collection IDs to pick up.
30 * P_ONESHOT : Are we gathering exactly one round of data?
31 * P_DEBUG : Enable debugging output?
43 static int debugging_on = 0; /*Are we debugging? */
44 static int one_shot = 0; /*Single round of data collection? */
46 static char *opNames[] = {
77 static char *xferOpNames[] = {
83 /*------------------------------------------------------------------------
87 * Print out the AFS_XSTATSCOLL_CALL_INFO collection we just
97 * All the info we need is nestled into xstat_fs_Results.
101 *------------------------------------------------------------------------*/
106 int i; /*Loop variable */
107 int numInt32s; /*# int32words returned */
108 afs_int32 *currInt32; /*Ptr to current afs_int32 value */
109 char *printableTime; /*Ptr to printable time string */
110 time_t probeTime = xstat_fs_Results.probeTime;
113 * Just print out the results of the particular probe.
115 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
116 currInt32 = (afs_int32 *) (xstat_fs_Results.data.AFS_CollData_val);
117 printableTime = ctime(&probeTime);
118 printableTime[strlen(printableTime) - 1] = '\0';
120 printf("AFS_XSTATSCOLL_CALL_INFO (coll %d) for FS %s\n[Probe %u, %s]\n\n",
121 xstat_fs_Results.collectionNumber,
122 xstat_fs_Results.connP->hostName, xstat_fs_Results.probeNum,
126 printf("\n[%u entries returned at %" AFS_PTR_FMT "]\n\n", numInt32s, currInt32);
128 for (i = 0; i < numInt32s; i++)
129 printf("%u ", *currInt32++);
135 /*------------------------------------------------------------------------
136 * PrintOverallPerfInfo
139 * Print out overall performance numbers.
142 * a_ovP : Ptr to the overall performance numbers.
148 * Nothing interesting.
152 *------------------------------------------------------------------------*/
155 PrintOverallPerfInfo(struct afs_PerfStats *a_ovP)
157 printf("\t%10u numPerfCalls\n\n", a_ovP->numPerfCalls);
160 * Vnode cache section.
162 printf("\t%10u vcache_L_Entries\n", a_ovP->vcache_L_Entries);
163 printf("\t%10u vcache_L_Allocs\n", a_ovP->vcache_L_Allocs);
164 printf("\t%10u vcache_L_Gets\n", a_ovP->vcache_L_Gets);
165 printf("\t%10u vcache_L_Reads\n", a_ovP->vcache_L_Reads);
166 printf("\t%10u vcache_L_Writes\n\n", a_ovP->vcache_L_Writes);
168 printf("\t%10u vcache_S_Entries\n", a_ovP->vcache_S_Entries);
169 printf("\t%10u vcache_S_Allocs\n", a_ovP->vcache_S_Allocs);
170 printf("\t%10u vcache_S_Gets\n", a_ovP->vcache_S_Gets);
171 printf("\t%10u vcache_S_Reads\n", a_ovP->vcache_S_Reads);
172 printf("\t%10u vcache_S_Writes\n\n", a_ovP->vcache_S_Writes);
174 printf("\t%10u vcache_H_Entries\n", a_ovP->vcache_H_Entries);
175 printf("\t%10u vcache_H_Gets\n", a_ovP->vcache_H_Gets);
176 printf("\t%10u vcache_H_Replacements\n\n", a_ovP->vcache_H_Replacements);
179 * Directory package section.
181 printf("\t%10u dir_Buffers\n", a_ovP->dir_Buffers);
182 printf("\t%10u dir_Calls\n", a_ovP->dir_Calls);
183 printf("\t%10u dir_IOs\n\n", a_ovP->dir_IOs);
188 printf("\t%10u rx_packetRequests\n", a_ovP->rx_packetRequests);
189 printf("\t%10u rx_noPackets_RcvClass\n", a_ovP->rx_noPackets_RcvClass);
190 printf("\t%10u rx_noPackets_SendClass\n", a_ovP->rx_noPackets_SendClass);
191 printf("\t%10u rx_noPackets_SpecialClass\n",
192 a_ovP->rx_noPackets_SpecialClass);
193 printf("\t%10u rx_socketGreedy\n", a_ovP->rx_socketGreedy);
194 printf("\t%10u rx_bogusPacketOnRead\n", a_ovP->rx_bogusPacketOnRead);
195 printf("\t%10u rx_bogusHost\n", a_ovP->rx_bogusHost);
196 printf("\t%10u rx_noPacketOnRead\n", a_ovP->rx_noPacketOnRead);
197 printf("\t%10u rx_noPacketBuffersOnRead\n",
198 a_ovP->rx_noPacketBuffersOnRead);
199 printf("\t%10u rx_selects\n", a_ovP->rx_selects);
200 printf("\t%10u rx_sendSelects\n", a_ovP->rx_sendSelects);
201 printf("\t%10u rx_packetsRead_RcvClass\n",
202 a_ovP->rx_packetsRead_RcvClass);
203 printf("\t%10u rx_packetsRead_SendClass\n",
204 a_ovP->rx_packetsRead_SendClass);
205 printf("\t%10u rx_packetsRead_SpecialClass\n",
206 a_ovP->rx_packetsRead_SpecialClass);
207 printf("\t%10u rx_dataPacketsRead\n", a_ovP->rx_dataPacketsRead);
208 printf("\t%10u rx_ackPacketsRead\n", a_ovP->rx_ackPacketsRead);
209 printf("\t%10u rx_dupPacketsRead\n", a_ovP->rx_dupPacketsRead);
210 printf("\t%10u rx_spuriousPacketsRead\n", a_ovP->rx_spuriousPacketsRead);
211 printf("\t%10u rx_packetsSent_RcvClass\n",
212 a_ovP->rx_packetsSent_RcvClass);
213 printf("\t%10u rx_packetsSent_SendClass\n",
214 a_ovP->rx_packetsSent_SendClass);
215 printf("\t%10u rx_packetsSent_SpecialClass\n",
216 a_ovP->rx_packetsSent_SpecialClass);
217 printf("\t%10u rx_ackPacketsSent\n", a_ovP->rx_ackPacketsSent);
218 printf("\t%10u rx_pingPacketsSent\n", a_ovP->rx_pingPacketsSent);
219 printf("\t%10u rx_abortPacketsSent\n", a_ovP->rx_abortPacketsSent);
220 printf("\t%10u rx_busyPacketsSent\n", a_ovP->rx_busyPacketsSent);
221 printf("\t%10u rx_dataPacketsSent\n", a_ovP->rx_dataPacketsSent);
222 printf("\t%10u rx_dataPacketsReSent\n", a_ovP->rx_dataPacketsReSent);
223 printf("\t%10u rx_dataPacketsPushed\n", a_ovP->rx_dataPacketsPushed);
224 printf("\t%10u rx_ignoreAckedPacket\n", a_ovP->rx_ignoreAckedPacket);
225 printf("\t%10u rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec);
226 printf("\t%10u rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec);
227 printf("\t%10u rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec);
228 printf("\t%10u rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec);
229 printf("\t%10u rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec);
230 printf("\t%10u rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec);
231 printf("\t%10u rx_nRttSamples\n", a_ovP->rx_nRttSamples);
232 printf("\t%10u rx_nServerConns\n", a_ovP->rx_nServerConns);
233 printf("\t%10u rx_nClientConns\n", a_ovP->rx_nClientConns);
234 printf("\t%10u rx_nPeerStructs\n", a_ovP->rx_nPeerStructs);
235 printf("\t%10u rx_nCallStructs\n", a_ovP->rx_nCallStructs);
236 printf("\t%10u rx_nFreeCallStructs\n", a_ovP->rx_nFreeCallStructs);
237 printf("\t%10u rx_nBusies\n\n", a_ovP->rx_nBusies);
239 printf("\t%10u fs_nBusies\n", a_ovP->fs_nBusies);
240 printf("\t%10u fs_GetCapabilities\n\n", a_ovP->fs_nGetCaps);
242 * Host module fields.
244 printf("\t%10u host_NumHostEntries\n", a_ovP->host_NumHostEntries);
245 printf("\t%10u host_HostBlocks\n", a_ovP->host_HostBlocks);
246 printf("\t%10u host_NonDeletedHosts\n", a_ovP->host_NonDeletedHosts);
247 printf("\t%10u host_HostsInSameNetOrSubnet\n",
248 a_ovP->host_HostsInSameNetOrSubnet);
249 printf("\t%10u host_HostsInDiffSubnet\n", a_ovP->host_HostsInDiffSubnet);
250 printf("\t%10u host_HostsInDiffNetwork\n",
251 a_ovP->host_HostsInDiffNetwork);
252 printf("\t%10u host_NumClients\n", a_ovP->host_NumClients);
253 printf("\t%10u host_ClientBlocks\n\n", a_ovP->host_ClientBlocks);
255 printf("\t%10u sysname_ID\n", a_ovP->sysname_ID);
259 /*------------------------------------------------------------------------
263 * Print out the contents of an RPC op timing structure.
266 * a_opIdx : Index of the AFS operation we're printing number on.
267 * a_opTimeP : Ptr to the op timing structure to print.
273 * Nothing interesting.
277 *------------------------------------------------------------------------*/
280 PrintOpTiming(int a_opIdx, struct fs_stats_opTimingData *a_opTimeP)
282 double fSumTime, avg;
285 ((double)(a_opTimeP->sumTime.tv_sec)) +
286 (((double)(a_opTimeP->sumTime.tv_usec)) / ((double)(1000000)));
287 /* printf("Double sum time is %f\n", fSumTime);*/
288 avg = fSumTime / ((double)(a_opTimeP->numSuccesses));
291 ("%15s: %u ops (%u OK); sum=%lu.%06lu, sqr=%lu.%06lu, min=%lu.%06lu, max=%lu.%06lu\n",
292 opNames[a_opIdx], a_opTimeP->numOps, a_opTimeP->numSuccesses,
293 (long)a_opTimeP->sumTime.tv_sec, (long)a_opTimeP->sumTime.tv_usec,
294 (long)a_opTimeP->sqrTime.tv_sec, (long)a_opTimeP->sqrTime.tv_usec,
295 (long)a_opTimeP->minTime.tv_sec, (long)a_opTimeP->minTime.tv_usec,
296 (long)a_opTimeP->maxTime.tv_sec, (long)a_opTimeP->maxTime.tv_usec);
300 /*------------------------------------------------------------------------
304 * Print out the contents of a data transfer structure.
307 * a_opIdx : Index of the AFS operation we're printing number on.
308 * a_xferP : Ptr to the data transfer structure to print.
314 * Nothing interesting.
318 *------------------------------------------------------------------------*/
321 PrintXferTiming(int a_opIdx, struct fs_stats_xferData *a_xferP)
323 double fSumTime, avg;
326 ((double)(a_xferP->sumTime.tv_sec)) +
327 ((double)(a_xferP->sumTime.tv_usec)) / ((double)(1000000));
329 avg = fSumTime / ((double)(a_xferP->numSuccesses));
332 ("%s: %u xfers (%u OK), time sum=%lu.%06lu, sqr=%lu.%06lu, min=%lu.%06lu, max=%lu.%06lu\n",
333 xferOpNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
334 (long)a_xferP->sumTime.tv_sec, (long)a_xferP->sumTime.tv_usec,
335 (long)a_xferP->sqrTime.tv_sec, (long)a_xferP->sqrTime.tv_usec,
336 (long)a_xferP->minTime.tv_sec, (long)a_xferP->minTime.tv_usec,
337 (long)a_xferP->maxTime.tv_sec, (long)a_xferP->maxTime.tv_usec);
338 printf("\t[bytes: sum=%u, min=%u, max=%u]\n", a_xferP->sumBytes,
339 a_xferP->minBytes, a_xferP->maxBytes);
341 ("\t[buckets: 0: %u, 1: %u, 2: %u, 3: %u, 4: %u, 5: %u, 6: %u, 7: %u, 8: %u]\n",
342 a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
343 a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
344 a_xferP->count[6], a_xferP->count[7], a_xferP->count[8]);
348 /*------------------------------------------------------------------------
349 * PrintDetailedPerfInfo
352 * Print out a set of detailed performance numbers.
355 * a_detP : Ptr to detailed perf numbers to print.
361 * Nothing interesting.
365 *------------------------------------------------------------------------*/
368 PrintDetailedPerfInfo(struct fs_stats_DetailedStats *a_detP)
370 int currIdx; /*Loop variable */
372 printf("\t%10lu epoch\n", (long) a_detP->epoch.tv_sec);
374 for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
375 PrintOpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]));
377 for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
378 PrintXferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]));
382 /*------------------------------------------------------------------------
386 * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just
396 * All the info we need is nestled into xstat_fs_Results.
400 *------------------------------------------------------------------------*/
403 PrintFullPerfInfo(void)
406 static afs_int32 fullPerfInt32s = (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # int32s to rcv */
407 afs_int32 numInt32s; /*# int32words received */
408 struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats */
409 char *printableTime; /*Ptr to printable time
411 time_t probeTime = xstat_fs_Results.probeTime;
413 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
414 if (numInt32s != fullPerfInt32s) {
415 printf("** Data size mismatch in full performance collection!");
416 printf("** Expecting %u, got %u\n", fullPerfInt32s, numInt32s);
420 printableTime = ctime(&probeTime);
421 printableTime[strlen(printableTime) - 1] = '\0';
422 fullPerfP = (struct fs_stats_FullPerfStats *)
423 (xstat_fs_Results.data.AFS_CollData_val);
426 ("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %u, %s]\n\n",
427 xstat_fs_Results.collectionNumber, xstat_fs_Results.connP->hostName,
428 xstat_fs_Results.probeNum, printableTime);
430 PrintOverallPerfInfo(&(fullPerfP->overall));
431 PrintDetailedPerfInfo(&(fullPerfP->det));
435 /*------------------------------------------------------------------------
439 * Print out the AFS_XSTATSCOLL_PERF_INFO collection we just
449 * All the info we need is nestled into xstat_fs_Results.
453 *------------------------------------------------------------------------*/
458 static afs_int32 perfInt32s = (sizeof(struct afs_PerfStats) >> 2); /*Correct # int32s to rcv */
459 afs_int32 numInt32s; /*# int32words received */
460 struct afs_PerfStats *perfP; /*Ptr to performance stats */
461 char *printableTime; /*Ptr to printable time string */
462 time_t probeTime = xstat_fs_Results.probeTime;
464 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
465 if (numInt32s != perfInt32s) {
466 printf("** Data size mismatch in performance collection!");
467 printf("** Expecting %u, got %u\n", perfInt32s, numInt32s);
471 printableTime = ctime(&probeTime);
472 printableTime[strlen(printableTime) - 1] = '\0';
473 perfP = (struct afs_PerfStats *)
474 (xstat_fs_Results.data.AFS_CollData_val);
476 printf("AFS_XSTATSCOLL_PERF_INFO (coll %d) for FS %s\n[Probe %u, %s]\n\n",
477 xstat_fs_Results.collectionNumber,
478 xstat_fs_Results.connP->hostName, xstat_fs_Results.probeNum,
481 PrintOverallPerfInfo(perfP);
484 static char *CbCounterStrings[] = {
490 "DeleteAllCallBacks",
491 "nFEs", "nCBs", "nblks",
494 "GSS1", "GSS2", "GSS3", "GSS4", "GSS5"
499 PrintCbCounters(void) {
500 int numInt32s = sizeof(CbCounterStrings)/sizeof(char *);
502 afs_int32 *val=xstat_fs_Results.data.AFS_CollData_val;
504 if (numInt32s > xstat_fs_Results.data.AFS_CollData_len)
505 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
507 for (i=0; i<numInt32s; i++) {
508 printf("\t%10u %s\n", val[i], CbCounterStrings[i]);
513 /*------------------------------------------------------------------------
517 * Handler routine passed to the xstat_fs module. This handler is
518 * called immediately after a poll of one of the File Servers has
519 * taken place. All it needs to know is exported by the xstat_fs
520 * module, namely the data structure where the probe results are
531 * See above. All we do now is print out what we got.
535 *------------------------------------------------------------------------*/
540 static char rn[] = "FS_Handler"; /*Routine name */
543 ("\n------------------------------------------------------------\n");
546 * If the probe failed, there isn't much we can do except gripe.
548 if (xstat_fs_Results.probeOK) {
549 printf("%s: Probe %u to File Server '%s' failed, code=%d\n", rn,
550 xstat_fs_Results.probeNum, xstat_fs_Results.connP->hostName,
551 xstat_fs_Results.probeOK);
555 switch (xstat_fs_Results.collectionNumber) {
556 case AFS_XSTATSCOLL_CALL_INFO:
560 case AFS_XSTATSCOLL_PERF_INFO:
564 case AFS_XSTATSCOLL_FULL_PERF_INFO:
568 case AFS_XSTATSCOLL_CBSTATS:
573 printf("** Unknown collection: %d\n",
574 xstat_fs_Results.collectionNumber);
578 * Return the happy news.
584 /*------------------------------------------------------------------------
588 * Given a pointer to the list of File Servers we'll be polling
589 * (or, in fact, any list at all), compute the length of the list.
592 * struct cmd_item *a_firstItem : Ptr to first item in list.
595 * Length of the above list.
598 * Nothing interesting.
602 *------------------------------------------------------------------------*/
605 CountListItems(struct cmd_item *a_firstItem)
608 int list_len; /*List length */
609 struct cmd_item *curr_item; /*Ptr to current item */
612 curr_item = a_firstItem;
619 curr_item = curr_item->next;
629 /*------------------------------------------------------------------------
633 * Routine called by the command line interpreter to execute the
634 * meat of the program. We count the number of File Servers
635 * to watch, allocate enough space to remember all the connection
636 * info for them, then go for it.
640 * a_s : Ptr to the command line syntax descriptor.
643 * 0, but may exit the whole program on an error!
646 * Nothing interesting.
650 *------------------------------------------------------------------------*/
653 RunTheTest(struct cmd_syndesc *a_s, void *dummy)
655 static char rn[] = "RunTheTest"; /*Routine name */
656 int code; /*Return code */
657 int numFSs; /*# File Servers to monitor */
658 int numCollIDs; /*# collections to fetch */
659 int currFS; /*Loop index */
660 int currCollIDIdx; /*Index of current collection ID */
661 afs_int32 *collIDP; /*Ptr to array of collection IDs */
662 afs_int32 *currCollIDP; /*Ptr to current collection ID */
663 struct cmd_item *curr_item; /*Current FS cmd line record */
664 struct sockaddr_in FSSktArray[20]; /*File Server socket array - FIX! */
665 struct hostent *he; /*Host entry */
666 struct timeval tv; /*Time structure */
667 int sleep_secs; /*Number of seconds to sleep */
668 int initFlags; /*Flags passed to the init fcn */
669 int waitCode; /*Result of LWP_WaitProcess() */
670 int freq; /*Frequency of polls */
671 int period; /*Time in minutes of data collection */
674 * Are we doing one-shot measurements?
676 if (a_s->parms[P_ONESHOT].items != 0)
680 * Are we doing debugging output?
682 if (a_s->parms[P_DEBUG].items != 0)
686 * Pull out the number of File Servers to watch and the number of
687 * collections to get.
689 numFSs = CountListItems(a_s->parms[P_FS_NAMES].items);
690 numCollIDs = CountListItems(a_s->parms[P_COLL_IDS].items);
692 /* Get the polling frequency */
693 if (a_s->parms[P_FREQUENCY].items != 0)
694 freq = atoi(a_s->parms[P_FREQUENCY].items->data);
696 freq = 30; /* default to 30 seconds */
698 /* Get the time duration to run the tests */
699 if (a_s->parms[P_PERIOD].items != 0)
700 period = atoi(a_s->parms[P_PERIOD].items->data);
702 period = 10; /* default to 10 minutes */
706 * Fill in the socket array for each of the File Servers listed.
708 curr_item = a_s->parms[P_FS_NAMES].items;
709 for (currFS = 0; currFS < numFSs; currFS++) {
710 FSSktArray[currFS].sin_family = AF_INET;
711 FSSktArray[currFS].sin_port = htons(7000); /* FileServer port */
712 he = hostutil_GetHostByName(curr_item->data);
714 fprintf(stderr, "[%s] Can't get host info for '%s'\n", rn,
718 memcpy(&(FSSktArray[currFS].sin_addr.s_addr), he->h_addr, 4);
721 * Move to the next File Server name.
723 curr_item = curr_item->next;
725 } /*Get socket info for each File Server */
728 * Create and fill up the array of desired collection IDs.
731 printf("Allocating %d long(s) for coll ID\n", numCollIDs);
732 collIDP = (afs_int32 *) (malloc(numCollIDs * sizeof(afs_int32)));
733 currCollIDP = collIDP;
734 curr_item = a_s->parms[P_COLL_IDS].items;
735 for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) {
736 *currCollIDP = (afs_int32) (atoi(curr_item->data));
738 printf("CollID at index %d is %d\n", currCollIDIdx, *currCollIDP);
739 curr_item = curr_item->next;
744 * Crank up the File Server prober, then sit back and have fun.
746 printf("\nStarting up the xstat_fs service, ");
749 initFlags |= XSTAT_FS_INITFLAG_DEBUGGING;
750 printf("debugging enabled, ");
752 printf("no debugging, ");
754 initFlags |= XSTAT_FS_INITFLAG_ONE_SHOT;
755 printf("one-shot operation\n");
757 printf("continuous operation\n");
759 code = xstat_fs_Init(numFSs, /*Num servers */
760 FSSktArray, /*File Server socket array */
761 freq, /*Probe frequency */
762 FS_Handler, /*Handler routine */
763 initFlags, /*Initialization flags */
764 numCollIDs, /*Number of collection IDs */
765 collIDP); /*Ptr to collection ID array */
767 fprintf(stderr, "[%s] Error returned by xstat_fs_Init: %d\n", rn,
769 xstat_fs_Cleanup(1); /*Get rid of malloc'ed structures */
775 * One-shot operation; just wait for the collection to be done.
778 printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT "\n", rn,
780 waitCode = LWP_WaitProcess(&terminationEvent);
782 printf("[%s] Returned from LWP_WaitProcess()\n", rn);
786 "[%s] Error %d encountered by LWP_WaitProcess()\n",
791 * Continuous operation.
793 sleep_secs = 60 * period; /*length of data collection */
795 ("xstat_fs service started, main thread sleeping for %d secs.\n",
799 * Let's just fall asleep for a while, then we'll clean up.
801 tv.tv_sec = sleep_secs;
803 code = IOMGR_Select(0, /*Num fds */
804 0, /*Descriptors ready for reading */
805 0, /*Descriptors ready for writing */
806 0, /*Descriptors with exceptional conditions */
807 &tv); /*Timeout structure */
810 "[%s] IOMGR_Select() returned non-zero value: %d\n", rn,
816 * We're all done. Clean up, put the last nail in Rx, then
820 printf("\nYawn, main thread just woke up. Cleaning things out...\n");
822 code = xstat_fs_Cleanup(1); /*Get rid of malloc'ed data */
828 #include "AFS_component_version_number.c"
831 main(int argc, char **argv)
833 static char rn[] = "xstat_fs_test"; /*Routine name */
834 afs_int32 code; /*Return code */
835 struct cmd_syndesc *ts; /*Ptr to cmd line syntax desc */
838 * Set up the commands we understand.
840 ts = cmd_CreateSyntax("initcmd", RunTheTest, 0, "initialize the program");
841 cmd_AddParm(ts, "-fsname", CMD_LIST, CMD_REQUIRED,
842 "File Server name(s) to monitor");
843 cmd_AddParm(ts, "-collID", CMD_LIST, CMD_REQUIRED,
844 "Collection(s) to fetch");
845 cmd_AddParm(ts, "-onceonly", CMD_FLAG, CMD_OPTIONAL,
846 "Collect results exactly once, then quit");
847 cmd_AddParm(ts, "-frequency", CMD_SINGLE, CMD_OPTIONAL,
848 "poll frequency, in seconds");
849 cmd_AddParm(ts, "-period", CMD_SINGLE, CMD_OPTIONAL,
850 "data collection time, in minutes");
851 cmd_AddParm(ts, "-debug", CMD_FLAG, CMD_OPTIONAL,
852 "turn on debugging output");
855 * Parse command-line switches & execute the test, then get the
858 code = cmd_Dispatch(argc, argv);
860 fprintf(stderr, "[%s] Call to cmd_Dispatch() failed; code is %d\n",