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 "xstat_fs.h" /*Interface for xstat_fs module*/
17 #include <cmd.h> /*Command line interpreter*/
21 * External routines that don't have explicit include file definitions.
23 extern struct hostent *hostutil_GetHostByName();
26 * Command line parameter indices.
27 * P_FS_NAMES : List of FileServer names.
28 * P_COLL_IDS : List of collection IDs to pick up.
29 * P_ONESHOT : Are we gathering exactly one round of data?
30 * P_DEBUG : Enable debugging output?
42 static int debugging_on = 0; /*Are we debugging?*/
43 static int one_shot = 0; /*Single round of data collection?*/
45 static char *opNames[] = {
76 static char *xferOpNames[] = {
82 /*------------------------------------------------------------------------
86 * Print out the AFS_XSTATSCOLL_CALL_INFO collection we just
96 * All the info we need is nestled into xstat_fs_Results.
100 *------------------------------------------------------------------------*/
106 static char rn[] = "PrintCallInfo"; /*Routine name*/
107 register int i; /*Loop variable*/
108 int numInt32s; /*# int32words returned*/
109 afs_int32 *currInt32; /*Ptr to current afs_int32 value*/
110 char *printableTime; /*Ptr to printable time string*/
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((time_t *)&(xstat_fs_Results.probeTime));
118 printableTime[strlen(printableTime)-1] = '\0';
120 printf("AFS_XSTATSCOLL_CALL_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
121 xstat_fs_Results.collectionNumber,
122 xstat_fs_Results.connP->hostName,
123 xstat_fs_Results.probeNum,
127 printf("\n[%d entries returned at 0x%x]\n\n",
128 numInt32s, currInt32);
130 for (i = 0; i < numInt32s; i++)
131 printf("%d ", *currInt32++);
132 fprintf(stderr, "\n");
137 /*------------------------------------------------------------------------
138 * PrintOverallPerfInfo
141 * Print out overall performance numbers.
144 * a_ovP : Ptr to the overall performance numbers.
150 * Nothing interesting.
154 *------------------------------------------------------------------------*/
156 void PrintOverallPerfInfo(a_ovP)
157 struct afs_PerfStats *a_ovP;
159 { /*PrintOverallPerfInfo*/
161 printf("\t%10d numPerfCalls\n\n", a_ovP->numPerfCalls);
164 * Vnode cache section.
166 printf("\t%10d vcache_L_Entries\n", a_ovP->vcache_L_Entries);
167 printf("\t%10d vcache_L_Allocs\n", a_ovP->vcache_L_Allocs);
168 printf("\t%10d vcache_L_Gets\n", a_ovP->vcache_L_Gets);
169 printf("\t%10d vcache_L_Reads\n", a_ovP->vcache_L_Reads);
170 printf("\t%10d vcache_L_Writes\n\n", a_ovP->vcache_L_Writes);
172 printf("\t%10d vcache_S_Entries\n", a_ovP->vcache_S_Entries);
173 printf("\t%10d vcache_S_Allocs\n", a_ovP->vcache_S_Allocs);
174 printf("\t%10d vcache_S_Gets\n", a_ovP->vcache_S_Gets);
175 printf("\t%10d vcache_S_Reads\n", a_ovP->vcache_S_Reads);
176 printf("\t%10d vcache_S_Writes\n\n", a_ovP->vcache_S_Writes);
178 printf("\t%10d vcache_H_Entries\n", a_ovP->vcache_H_Entries);
179 printf("\t%10d vcache_H_Gets\n", a_ovP->vcache_H_Gets);
180 printf("\t%10d vcache_H_Replacements\n\n", a_ovP->vcache_H_Replacements);
183 * Directory package section.
185 printf("\t%10d dir_Buffers\n", a_ovP->dir_Buffers);
186 printf("\t%10d dir_Calls\n", a_ovP->dir_Calls);
187 printf("\t%10d dir_IOs\n\n", a_ovP->dir_IOs);
192 printf("\t%10d rx_packetRequests\n", a_ovP->rx_packetRequests);
193 printf("\t%10d rx_noPackets_RcvClass\n", a_ovP->rx_noPackets_RcvClass);
194 printf("\t%10d rx_noPackets_SendClass\n", a_ovP->rx_noPackets_SendClass);
195 printf("\t%10d rx_noPackets_SpecialClass\n", a_ovP->rx_noPackets_SpecialClass);
196 printf("\t%10d rx_socketGreedy\n", a_ovP->rx_socketGreedy);
197 printf("\t%10d rx_bogusPacketOnRead\n", a_ovP->rx_bogusPacketOnRead);
198 printf("\t%10d rx_bogusHost\n", a_ovP->rx_bogusHost);
199 printf("\t%10d rx_noPacketOnRead\n", a_ovP->rx_noPacketOnRead);
200 printf("\t%10d rx_noPacketBuffersOnRead\n", a_ovP->rx_noPacketBuffersOnRead);
201 printf("\t%10d rx_selects\n", a_ovP->rx_selects);
202 printf("\t%10d rx_sendSelects\n", a_ovP->rx_sendSelects);
203 printf("\t%10d rx_packetsRead_RcvClass\n", a_ovP->rx_packetsRead_RcvClass);
204 printf("\t%10d rx_packetsRead_SendClass\n", a_ovP->rx_packetsRead_SendClass);
205 printf("\t%10d rx_packetsRead_SpecialClass\n", a_ovP->rx_packetsRead_SpecialClass);
206 printf("\t%10d rx_dataPacketsRead\n", a_ovP->rx_dataPacketsRead);
207 printf("\t%10d rx_ackPacketsRead\n", a_ovP->rx_ackPacketsRead);
208 printf("\t%10d rx_dupPacketsRead\n", a_ovP->rx_dupPacketsRead);
209 printf("\t%10d rx_spuriousPacketsRead\n", a_ovP->rx_spuriousPacketsRead);
210 printf("\t%10d rx_packetsSent_RcvClass\n", a_ovP->rx_packetsSent_RcvClass);
211 printf("\t%10d rx_packetsSent_SendClass\n", a_ovP->rx_packetsSent_SendClass);
212 printf("\t%10d rx_packetsSent_SpecialClass\n", a_ovP->rx_packetsSent_SpecialClass);
213 printf("\t%10d rx_ackPacketsSent\n", a_ovP->rx_ackPacketsSent);
214 printf("\t%10d rx_pingPacketsSent\n", a_ovP->rx_pingPacketsSent);
215 printf("\t%10d rx_abortPacketsSent\n", a_ovP->rx_abortPacketsSent);
216 printf("\t%10d rx_busyPacketsSent\n", a_ovP->rx_busyPacketsSent);
217 printf("\t%10d rx_dataPacketsSent\n", a_ovP->rx_dataPacketsSent);
218 printf("\t%10d rx_dataPacketsReSent\n", a_ovP->rx_dataPacketsReSent);
219 printf("\t%10d rx_dataPacketsPushed\n", a_ovP->rx_dataPacketsPushed);
220 printf("\t%10d rx_ignoreAckedPacket\n", a_ovP->rx_ignoreAckedPacket);
221 printf("\t%10d rx_totalRtt_Sec\n", a_ovP->rx_totalRtt_Sec);
222 printf("\t%10d rx_totalRtt_Usec\n", a_ovP->rx_totalRtt_Usec);
223 printf("\t%10d rx_minRtt_Sec\n", a_ovP->rx_minRtt_Sec);
224 printf("\t%10d rx_minRtt_Usec\n", a_ovP->rx_minRtt_Usec);
225 printf("\t%10d rx_maxRtt_Sec\n", a_ovP->rx_maxRtt_Sec);
226 printf("\t%10d rx_maxRtt_Usec\n", a_ovP->rx_maxRtt_Usec);
227 printf("\t%10d rx_nRttSamples\n", a_ovP->rx_nRttSamples);
228 printf("\t%10d rx_nServerConns\n", a_ovP->rx_nServerConns);
229 printf("\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns);
230 printf("\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs);
231 printf("\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs);
232 printf("\t%10d rx_nFreeCallStructs\n\n", a_ovP->rx_nFreeCallStructs);
235 * Host module fields.
237 printf("\t%10d host_NumHostEntries\n", a_ovP->host_NumHostEntries);
238 printf("\t%10d host_HostBlocks\n", a_ovP->host_HostBlocks);
239 printf("\t%10d host_NonDeletedHosts\n", a_ovP->host_NonDeletedHosts);
240 printf("\t%10d host_HostsInSameNetOrSubnet\n", a_ovP->host_HostsInSameNetOrSubnet);
241 printf("\t%10d host_HostsInDiffSubnet\n", a_ovP->host_HostsInDiffSubnet);
242 printf("\t%10d host_HostsInDiffNetwork\n", a_ovP->host_HostsInDiffNetwork);
243 printf("\t%10d host_NumClients\n", a_ovP->host_NumClients);
244 printf("\t%10d host_ClientBlocks\n\n", a_ovP->host_ClientBlocks);
246 printf("\t%10d sysname_ID\n", a_ovP->sysname_ID);
248 } /*PrintOverallPerfInfo*/
251 /*------------------------------------------------------------------------
255 * Print out the contents of an RPC op timing structure.
258 * a_opIdx : Index of the AFS operation we're printing number on.
259 * a_opTimeP : Ptr to the op timing structure to print.
265 * Nothing interesting.
269 *------------------------------------------------------------------------*/
271 void PrintOpTiming(a_opIdx, a_opTimeP)
273 struct fs_stats_opTimingData *a_opTimeP;
277 double fSumTime, avg;
279 fSumTime = ((double)(a_opTimeP->sumTime.tv_sec)) +
280 (((double)(a_opTimeP->sumTime.tv_usec))/((double)(1000000)));
281 /* printf("Double sum time is %f\n", fSumTime);*/
282 avg = fSumTime/((double)(a_opTimeP->numSuccesses));
284 printf("%15s: %d ops (%d OK); sum=%d.%06d, sqr=%d.%06d, min=%d.%06d, max=%d.%06d\n",
286 a_opTimeP->numOps, a_opTimeP->numSuccesses,
287 a_opTimeP->sumTime.tv_sec, a_opTimeP->sumTime.tv_usec,
288 a_opTimeP->sqrTime.tv_sec, a_opTimeP->sqrTime.tv_usec,
289 a_opTimeP->minTime.tv_sec, a_opTimeP->minTime.tv_usec,
290 a_opTimeP->maxTime.tv_sec, a_opTimeP->maxTime.tv_usec);
295 /*------------------------------------------------------------------------
299 * Print out the contents of a data transfer structure.
302 * a_opIdx : Index of the AFS operation we're printing number on.
303 * a_xferP : Ptr to the data transfer structure to print.
309 * Nothing interesting.
313 *------------------------------------------------------------------------*/
315 void PrintXferTiming(a_opIdx, a_xferP)
317 struct fs_stats_xferData *a_xferP;
319 { /*PrintXferTiming*/
321 double fSumTime, avg;
323 fSumTime = ((double)(a_xferP->sumTime.tv_sec)) +
324 ((double)(a_xferP->sumTime.tv_usec))/((double)(1000000));
326 avg = fSumTime/((double)(a_xferP->numSuccesses));
328 printf("%s: %d xfers (%d OK), time sum=%d.%06d, sqr=%d.%06d, min=%d.%06d, max=%d.%06d\n",
329 xferOpNames[a_opIdx],
330 a_xferP->numXfers, a_xferP->numSuccesses,
331 a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
332 a_xferP->sqrTime.tv_sec, a_xferP->sqrTime.tv_usec,
333 a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
334 a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
335 printf("\t[bytes: sum=%lu, min=%d, max=%d]\n",
336 a_xferP->sumBytes, a_xferP->minBytes, a_xferP->maxBytes);
337 printf("\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d, 7: %d, 8: %d]\n",
349 } /*PrintXferTiming*/
352 /*------------------------------------------------------------------------
353 * PrintDetailedPerfInfo
356 * Print out a set of detailed performance numbers.
359 * a_detP : Ptr to detailed perf numbers to print.
365 * Nothing interesting.
369 *------------------------------------------------------------------------*/
371 void PrintDetailedPerfInfo(a_detP)
372 struct fs_stats_DetailedStats *a_detP;
374 { /*PrintDetailedPerfInfo*/
376 int currIdx; /*Loop variable*/
378 printf("\t%10d epoch\n", a_detP->epoch);
380 for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
381 PrintOpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]));
383 for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
384 PrintXferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]));
386 } /*PrintDetailedPerfInfo*/
389 /*------------------------------------------------------------------------
393 * Print out the AFS_XSTATSCOLL_FULL_PERF_INFO collection we just
403 * All the info we need is nestled into xstat_fs_Results.
407 *------------------------------------------------------------------------*/
409 void PrintFullPerfInfo()
411 { /*PrintFullPerfInfo*/
413 static char rn[] = "PrintFullPerfInfo"; /*Routine name*/
414 static afs_int32 fullPerfInt32s =
415 (sizeof(struct fs_stats_FullPerfStats) >> 2); /*Correct # int32s to rcv*/
416 afs_int32 numInt32s; /*# int32words received*/
417 struct fs_stats_FullPerfStats *fullPerfP; /*Ptr to full perf stats*/
418 char *printableTime; /*Ptr to printable time
421 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
422 if (numInt32s != fullPerfInt32s) {
423 printf("** Data size mismatch in full performance collection!");
424 printf("** Expecting %d, got %d\n", fullPerfInt32s, numInt32s);
428 printableTime = ctime((time_t *)&(xstat_fs_Results.probeTime));
429 printableTime[strlen(printableTime)-1] = '\0';
430 fullPerfP = (struct fs_stats_FullPerfStats *)
431 (xstat_fs_Results.data.AFS_CollData_val);
433 printf("AFS_XSTATSCOLL_FULL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
434 xstat_fs_Results.collectionNumber,
435 xstat_fs_Results.connP->hostName,
436 xstat_fs_Results.probeNum,
439 PrintOverallPerfInfo(&(fullPerfP->overall));
440 PrintDetailedPerfInfo(&(fullPerfP->det));
442 } /*PrintFullPerfInfo*/
445 /*------------------------------------------------------------------------
449 * Print out the AFS_XSTATSCOLL_PERF_INFO collection we just
459 * All the info we need is nestled into xstat_fs_Results.
463 *------------------------------------------------------------------------*/
469 static char rn[] = "PrintPerfInfo"; /*Routine name*/
470 static afs_int32 perfInt32s =
471 (sizeof(struct afs_PerfStats) >> 2); /*Correct # int32s to rcv*/
472 afs_int32 numInt32s; /*# int32words received*/
473 struct afs_PerfStats *perfP; /*Ptr to performance stats*/
474 char *printableTime; /*Ptr to printable time string*/
476 numInt32s = xstat_fs_Results.data.AFS_CollData_len;
477 if (numInt32s != perfInt32s) {
478 printf("** Data size mismatch in performance collection!");
479 printf("** Expecting %d, got %d\n", perfInt32s, numInt32s);
483 printableTime = ctime((time_t *)&(xstat_fs_Results.probeTime));
484 printableTime[strlen(printableTime)-1] = '\0';
485 perfP = (struct afs_PerfStats *)
486 (xstat_fs_Results.data.AFS_CollData_val);
488 printf("AFS_XSTATSCOLL_PERF_INFO (coll %d) for FS %s\n[Probe %d, %s]\n\n",
489 xstat_fs_Results.collectionNumber,
490 xstat_fs_Results.connP->hostName,
491 xstat_fs_Results.probeNum,
494 PrintOverallPerfInfo(perfP);
499 /*------------------------------------------------------------------------
503 * Handler routine passed to the xstat_fs module. This handler is
504 * called immediately after a poll of one of the File Servers has
505 * taken place. All it needs to know is exported by the xstat_fs
506 * module, namely the data structure where the probe results are
517 * See above. All we do now is print out what we got.
521 *------------------------------------------------------------------------*/
527 static char rn[] = "FS_Handler"; /*Routine name*/
529 printf("\n------------------------------------------------------------\n");
532 * If the probe failed, there isn't much we can do except gripe.
534 if (xstat_fs_Results.probeOK) {
535 printf("%s: Probe %d to File Server '%s' failed, code=%d\n",
536 rn, xstat_fs_Results.probeNum,
537 xstat_fs_Results.connP->hostName,
538 xstat_fs_Results.probeOK);
542 switch(xstat_fs_Results.collectionNumber) {
543 case AFS_XSTATSCOLL_CALL_INFO:
547 case AFS_XSTATSCOLL_PERF_INFO:
551 case AFS_XSTATSCOLL_FULL_PERF_INFO:
556 printf("** Unknown collection: %d\n",
557 xstat_fs_Results.collectionNumber);
561 * Return the happy news.
568 /*------------------------------------------------------------------------
572 * Given a pointer to the list of File Servers we'll be polling
573 * (or, in fact, any list at all), compute the length of the list.
576 * struct cmd_item *a_firstItem : Ptr to first item in list.
579 * Length of the above list.
582 * Nothing interesting.
586 *------------------------------------------------------------------------*/
588 static int CountListItems(a_firstItem)
589 struct cmd_item *a_firstItem;
593 int list_len; /*List length*/
594 struct cmd_item *curr_item; /*Ptr to current item*/
597 curr_item = a_firstItem;
604 curr_item = curr_item->next;
615 /*------------------------------------------------------------------------
619 * Routine called by the command line interpreter to execute the
620 * meat of the program. We count the number of File Servers
621 * to watch, allocate enough space to remember all the connection
622 * info for them, then go for it.
626 * a_s : Ptr to the command line syntax descriptor.
629 * 0, but may exit the whole program on an error!
632 * Nothing interesting.
636 *------------------------------------------------------------------------*/
639 struct cmd_syndesc *a_s;
643 static char rn[] = "RunTheTest"; /*Routine name*/
644 int code; /*Return code*/
645 int numFSs; /*# File Servers to monitor*/
646 int numCollIDs; /*# collections to fetch*/
647 int currFS; /*Loop index*/
648 int currCollIDIdx; /*Index of current collection ID*/
649 afs_int32 *collIDP; /*Ptr to array of collection IDs*/
650 afs_int32 *currCollIDP; /*Ptr to current collection ID*/
651 struct cmd_item *curr_item; /*Current FS cmd line record*/
652 struct sockaddr_in FSSktArray[20]; /*File Server socket array - FIX!*/
653 struct hostent *he; /*Host entry*/
654 struct timeval tv; /*Time structure*/
655 int sleep_secs; /*Number of seconds to sleep*/
656 int initFlags; /*Flags passed to the init fcn*/
657 int waitCode; /*Result of LWP_WaitProcess()*/
658 int freq; /*Frequency of polls*/
659 int period; /*Time in minutes of data collection*/
662 * Are we doing one-shot measurements?
664 if (a_s->parms[P_ONESHOT].items != 0)
668 * Are we doing debugging output?
670 if (a_s->parms[P_DEBUG].items != 0)
674 * Pull out the number of File Servers to watch and the number of
675 * collections to get.
677 numFSs = CountListItems(a_s->parms[P_FS_NAMES].items);
678 numCollIDs = CountListItems(a_s->parms[P_COLL_IDS].items);
680 /* Get the polling frequency */
681 if (a_s->parms[P_FREQUENCY].items != 0)
682 freq = atoi(a_s->parms[P_FREQUENCY].items->data);
684 freq = 30; /* default to 30 seconds */
686 /* Get the time duration to run the tests */
687 if (a_s->parms[P_PERIOD].items != 0)
688 period = atoi(a_s->parms[P_PERIOD].items->data);
690 period = 10; /* default to 10 minutes */
694 * Fill in the socket array for each of the File Servers listed.
696 curr_item = a_s->parms[P_FS_NAMES].items;
697 for (currFS = 0; currFS < numFSs; currFS++) {
698 FSSktArray[currFS].sin_family = htons(AF_INET); /*Internet family*/
699 FSSktArray[currFS].sin_port = htons(7000); /*FileServer port*/
700 he = hostutil_GetHostByName(curr_item->data);
701 if (he == (struct hostent *)0) {
703 "[%s] Can't get host info for '%s'\n",
704 rn, curr_item->data);
707 bcopy(he->h_addr, &(FSSktArray[currFS].sin_addr.s_addr), 4);
710 * Move to the next File Server name.
712 curr_item = curr_item->next;
714 } /*Get socket info for each File Server*/
717 * Create and fill up the array of desired collection IDs.
720 printf("Allocating %d long(s) for coll ID\n", numCollIDs);
721 collIDP = (afs_int32 *)(malloc(numCollIDs * sizeof(afs_int32)));
722 currCollIDP = collIDP;
723 curr_item = a_s->parms[P_COLL_IDS].items;
724 for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) {
725 *currCollIDP = (afs_int32)(atoi(curr_item->data));
727 printf("CollID at index %d is %d\n", currCollIDIdx, *currCollIDP);
728 curr_item = curr_item->next;
733 * Crank up the File Server prober, then sit back and have fun.
735 printf("\nStarting up the xstat_fs service, ");
738 initFlags |= XSTAT_FS_INITFLAG_DEBUGGING;
739 printf("debugging enabled, ");
742 printf("no debugging, ");
744 initFlags |= XSTAT_FS_INITFLAG_ONE_SHOT;
745 printf("one-shot operation\n");
748 printf("continuous operation\n");
750 code = xstat_fs_Init(numFSs, /*Num servers*/
751 FSSktArray, /*File Server socket array*/
752 freq, /*Probe frequency*/
753 FS_Handler, /*Handler routine*/
754 initFlags, /*Initialization flags*/
755 numCollIDs, /*Number of collection IDs*/
756 collIDP); /*Ptr to collection ID array*/
759 "[%s] Error returned by xstat_fs_Init: %d\n",
761 xstat_fs_Cleanup(1); /*Get rid of malloc'ed structures*/
767 * One-shot operation; just wait for the collection to be done.
770 printf("[%s] Calling LWP_WaitProcess() on event 0x%x\n",
771 rn, &terminationEvent);
772 waitCode = LWP_WaitProcess(&terminationEvent);
774 printf("[%s] Returned from LWP_WaitProcess()\n", rn);
778 "[%s] Error %d encountered by LWP_WaitProcess()\n",
784 * Continuous operation.
786 sleep_secs = 60*period; /*length of data collection*/
787 printf("xstat_fs service started, main thread sleeping for %d secs.\n",
791 * Let's just fall asleep for a while, then we'll clean up.
793 tv.tv_sec = sleep_secs;
795 code = IOMGR_Select(0, /*Num fds*/
796 0, /*Descriptors ready for reading*/
797 0, /*Descriptors ready for writing*/
798 0, /*Descriptors with exceptional conditions*/
799 &tv); /*Timeout structure*/
802 "[%s] IOMGR_Select() returned non-zero value: %d\n",
808 * We're all done. Clean up, put the last nail in Rx, then
812 printf("\nYawn, main thread just woke up. Cleaning things out...\n");
814 code = xstat_fs_Cleanup(1); /*Get rid of malloc'ed data*/
821 #include "AFS_component_version_number.c"
829 static char rn[] = "xstat_fs_test"; /*Routine name*/
830 register afs_int32 code; /*Return code*/
831 struct cmd_syndesc *ts; /*Ptr to cmd line syntax desc*/
834 * Set up the commands we understand.
836 ts = cmd_CreateSyntax("initcmd", RunTheTest, 0,
837 "initialize the program");
838 cmd_AddParm(ts, "-fsname", CMD_LIST, CMD_REQUIRED,
839 "File Server name(s) to monitor");
840 cmd_AddParm(ts, "-collID", CMD_LIST, CMD_REQUIRED,
841 "Collection(s) to fetch");
842 cmd_AddParm(ts, "-onceonly", CMD_FLAG, CMD_OPTIONAL,
843 "Collect results exactly once, then quit");
844 cmd_AddParm(ts, "-frequency", CMD_SINGLE, CMD_OPTIONAL,
845 "poll frequency, in seconds");
846 cmd_AddParm(ts, "-period", CMD_SINGLE, CMD_OPTIONAL,
847 "data collection time, in minutes");
848 cmd_AddParm(ts, "-debug", CMD_FLAG, CMD_OPTIONAL,
849 "turn on debugging output");
852 * Parse command-line switches & execute the test, then get the
855 code = cmd_Dispatch(argc, argv);
858 "[%s] Call to cmd_Dispatch() failed; code is %d\n",