AFS-Monitor

 view release on metacpan or  search on metacpan

src/Monitor.xs  view on Meta::CPAN


   fprintf(cm_outFD, "\tVL Server up/downtimes, same cell:\n");
   my_Print_cm_UpDownStats(&(a_ovP->vl_UpDown[0]), cm_outFD);

   fprintf(cm_outFD, "\tVL Server up/downtimes, diff cell:\n");
   my_Print_cm_UpDownStats(&(a_ovP->vl_UpDown[1]), cm_outFD);

}   /* my_Print_cm_OverallPerfInfo() */


/*
 * from src/afsmonitor/afsmon-output.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_Print_cm_RPCPerfInfo(a_rpcP, cm_outFD)
   struct afs_stats_RPCOpInfo *a_rpcP;
   FILE *cm_outFD;
{

   int currIdx;                 /*Loop variable */

   /*
    * Print the contents of each of the opcode-related arrays.
    */
   fprintf(cm_outFD, "FS Operation Timings:\n---------------------\n");
   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
      my_Print_cm_OpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx]),
                           cm_outFD);

   fprintf(cm_outFD, "\nError Info:\n-----------\n");
   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
      my_Print_cm_ErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx]),
                          cm_outFD);

   fprintf(cm_outFD, "\nTransfer timings:\n-----------------\n");
   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++)
      my_Print_cm_XferTiming(currIdx, xferOpNames,
                             &(a_rpcP->fsXferTimes[currIdx]), cm_outFD);

   fprintf(cm_outFD, "\nCM Operation Timings:\n---------------------\n");
   for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
      my_Print_cm_OpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]),
                           cm_outFD);

}   /* my_Print_cm_RPCPerfInfo() */



/*
 * from src/afsmonitor/afsmon-output.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_Print_cm_FullPerfInfo(xstat_cm_Results, cm_outFD)
   struct xstat_cm_ProbeResults xstat_cm_Results;
   FILE *cm_outFD;
{
   /* Ptr to authentication stats */
   struct afs_stats_AuthentInfo *authentP;
   /* Ptr to access stats */
   struct afs_stats_AccessInfo *accessinfP;
   /* Correct #longs */
   static afs_int32 fullPerfLongs = (sizeof(struct afs_stats_CMFullPerf) >> 2);
   /* # longs actually received */
   afs_int32 numLongs;
   /* Ptr to full perf info */
   struct afs_stats_CMFullPerf *fullP;
   /* Ptr to printable time string */
   char *printableTime;

   numLongs = xstat_cm_Results.data.AFSCB_CollData_len;

   if (numLongs != fullPerfLongs) {

      fprintf(cm_outFD,
              " ** Data size mismatch in performance collection!\n");
      fprintf(cm_outFD, " ** Expecting %d, got %d\n", fullPerfLongs,
              numLongs);
      return;
   }

   printableTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
   printableTime[strlen(printableTime) - 1] = '\0';
   fullP = (struct afs_stats_CMFullPerf *)
      (xstat_cm_Results.data.AFSCB_CollData_val);

   fprintf(cm_outFD,
           "AFSCB_XSTATSCOLL_FULL_PERF_INFO (coll %d) for CM %s\n[Probe %d, %s]\n\n",
           xstat_cm_Results.collectionNumber,
           xstat_cm_Results.connP->hostName, xstat_cm_Results.probeNum,
           printableTime);

   /*
    * Print the overall numbers first, followed by all of the RPC numbers,
    * then each of the other groupings.
    */
   fprintf(cm_outFD,
           "Overall Performance Info:\n-------------------------\n");
   my_Print_cm_OverallPerfInfo(&(fullP->perf), cm_outFD);
   fprintf(cm_outFD, "\n");
   my_Print_cm_RPCPerfInfo(&(fullP->rpc), cm_outFD);

   authentP = &(fullP->authent);
   fprintf(cm_outFD, "\nAuthentication info:\n--------------------\n");
   fprintf(cm_outFD,
           "\t%d PAGS, %d records (%d auth, %d unauth), %d max in PAG, chain max: %d\n",
           authentP->curr_PAGs, authentP->curr_Records,
           authentP->curr_AuthRecords, authentP->curr_UnauthRecords,
           authentP->curr_MaxRecordsInPAG, authentP->curr_LongestChain);
   fprintf(cm_outFD, "\t%d PAG creations, %d tkt updates\n",
           authentP->PAGCreations, authentP->TicketUpdates);
   fprintf(cm_outFD,
           "\t[HWMs: %d PAGS, %d records, %d max in PAG, chain max: %d]\n",
           authentP->HWM_PAGs, authentP->HWM_Records,
           authentP->HWM_MaxRecordsInPAG, authentP->HWM_LongestChain);

   accessinfP = &(fullP->accessinf);
   fprintf(cm_outFD,
           "\n[Un]replicated accesses:\n------------------------\n");
   fprintf(cm_outFD,
           "\t%d unrep, %d rep, %d reps accessed, %d max reps/ref, %d first OK\n\n",
           accessinfP->unreplicatedRefs, accessinfP->replicatedRefs,
           accessinfP->numReplicasAccessed, accessinfP->maxReplicasPerRef,
           accessinfP->refFirstReplicaOK);

   /* There really isn't any authorship info
    * authorP = &(fullP->author); */
}   /* my_Print_cm_FullPerfInfo() */


/*
 * from src/afsmonitor/afsmon-output.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_afsmon_cmOutput(a_outfile, a_detOutput, xstat_cm_Results)
   char *a_outfile;             /* ptr to output file name */
   int a_detOutput;             /* detailed output ? */
   struct xstat_cm_ProbeResults xstat_cm_Results;
{

   char *printTime = 0;         /* ptr to time string */
   char *hostname = 0;          /* fileserner name */
   afs_int32 numLongs = 0;      /* longwords in result */
   afs_int32 *currLong = 0;     /* ptr to longwords in result */
   int i = 0;
   FILE *cm_outFD = 0;

   cm_outFD = fopen(a_outfile, "a");
   if (cm_outFD == (FILE *) NULL) {
      warn("failed to open output file %s", a_outfile);
      return;
   }

   /* get the probe time and strip the \n at the end */
   printTime = ctime((time_t *) & (xstat_cm_Results.probeTime));
   printTime[strlen(printTime) - 1] = '\0';
   hostname = xstat_cm_Results.connP->hostName;

   /* print "time hostname CM" prefix */
   fprintf(cm_outFD, "\n%s %s CM ", printTime, hostname);

   /* if probe failed print -1 and vanish */
   if (xstat_cm_Results.probeOK) {
      fprintf(cm_outFD, "-1\n");
      fclose(cm_outFD);
      return;
   }

   /* print out the probe information as  long words */
   numLongs = xstat_cm_Results.data.AFSCB_CollData_len;
   currLong = (afs_int32 *) (xstat_cm_Results.data.AFSCB_CollData_val);

   for (i = 0; i < numLongs; i++) {
      fprintf(cm_outFD, "%d ", *currLong++);
   }
   fprintf(cm_outFD, "\n\n");

   /* print detailed information */
   if (a_detOutput) {
      my_Print_cm_FullPerfInfo(xstat_cm_Results, cm_outFD);
      fflush(cm_outFD);
   }

   fclose(cm_outFD);

src/Monitor.xs  view on Meta::CPAN

      tmpbuf = srcbuf++;    /* sqr time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* min time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* max time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      sprintf(a_cmData->data[idx], "%d", *srcbuf);  /* sum bytes */
      idx++;
      srcbuf++;
      sprintf(a_cmData->data[idx], "%d", *srcbuf);  /* min bytes */
      idx++;
      srcbuf++;
      sprintf(a_cmData->data[idx], "%d", *srcbuf);  /* max bytes */
      idx++;
      srcbuf++;
      for (j = 0; j < AFS_STATS_NUM_XFER_BUCKETS; j++) {
         sprintf(a_cmData->data[idx], "%d", *srcbuf);   /* bucket[j] */
         idx++;
         srcbuf++;
      }
   }

   /*printf("Ending index value = %d\n",idx-1); */

   /* copy CM operations timings */

   srcbuf = (afs_int32 *) (fullP->rpc.cmRPCTimes);
   for (i = 0; i < AFS_STATS_NUM_CM_RPC_OPS; i++) {
      sprintf(a_cmData->data[idx], "%d", *srcbuf);  /* numOps */
      idx++;
      srcbuf++;
      sprintf(a_cmData->data[idx], "%d", *srcbuf);  /* numSuccesses */
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* sum time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* sqr time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* min time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
      tmpbuf = srcbuf++;    /* max time */
      sprintf(a_cmData->data[idx], "%d.%06d", *tmpbuf, *srcbuf);
      idx++;
      srcbuf++;
   }

   /*printf("Ending index value = %d\n",idx-1); */

   /* copy authentication info */

   srcbuf = (afs_int32 *) & (fullP->authent);
   numLongs = sizeof(struct afs_stats_AuthentInfo) / sizeof(afs_int32);
   for (i = 0; i < numLongs; i++) {
      sprintf(a_cmData->data[idx], "%d", *srcbuf);
      idx++;
      srcbuf++;
   }

   /*printf("Ending index value = %d\n",idx-1); */

   /* copy CM [un]replicated access info */

   srcbuf = (afs_int32 *) & (fullP->accessinf);
   numLongs = sizeof(struct afs_stats_AccessInfo) / sizeof(afs_int32);
   for (i = 0; i < numLongs; i++) {
      sprintf(a_cmData->data[idx], "%d", *srcbuf);
      idx++;
      srcbuf++;
   }

   /*printf("Ending index value = %d\n",idx-1); */
   return (0);

}   /* my_cm_Results_ltoa() */




/* cm_Results_to_Hash() */

void
cm_Results_to_Hash(struct cm_Display_Data *cmData, HV *HOSTINFO,
                   short *showFlags, int showDefault)
{
   int secidx;
   int grpidx;
   int numgrp;
   int fromidx;
   int toidx;
   char section[CFG_STR_LEN] = "";
   char group[CFG_STR_LEN] = "";
   HV *ENTRY;
   HV *GROUP;
   HV *SECTION;
   int i;

   secidx = 0;
   grpidx = secidx + 1;

   while (secidx < CM_NUM_DATA_CATEGORIES) {

      sscanf(cm_categories[secidx], "%s %d", section, &numgrp);
      SECTION = newHV();

      while (grpidx <= secidx + numgrp) {
         GROUP = newHV();
         sscanf(cm_categories[grpidx], "%s %d %d", group, &fromidx, &toidx);
         for (i = fromidx; i <= toidx; i++) {
            if (showFlags[i] || showDefault) {
               ENTRY = newHV();
               hv_store(ENTRY, "value", 5, newSVnv(atof(cmData->data[i])), 0);

src/Monitor.xs  view on Meta::CPAN


   for (i = 0; i <= 8; i++)
      av_store(COUNT, i, newSViv(a_xferP->count[i]));

   hv_store(TIMES, "count", 5, newRV_inc((SV *) COUNT), 0);

   hv_store(XFERTIMES, a_opNames[a_opIdx], strlen(a_opNames[a_opIdx]),
            newRV_inc((SV *) TIMES), 0);
}


/*
 * from src/xstat/xstat_cm_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_PrintRPCPerfInfo(struct afs_stats_RPCOpInfo *a_rpcP, HV *RPC)
{
   int currIdx;
   HV *FSRPCTIMES  = newHV();
   HV *FSRPCERRORS = newHV();
   HV *FSXFERTIMES = newHV();
   HV *CMRPCTIMES  = newHV();

   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
      my_cm_PrintOpTiming(currIdx, fsOpNames, &(a_rpcP->fsRPCTimes[currIdx]),
                          FSRPCTIMES);

   hv_store(RPC, "fsRPCTimes", 10, newRV_inc((SV *) FSRPCTIMES), 0);

   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_RPC_OPS; currIdx++)
      my_cm_PrintErrInfo(currIdx, fsOpNames, &(a_rpcP->fsRPCErrors[currIdx]),
                         FSRPCERRORS);

   hv_store(RPC, "fsRPCErrors", 11, newRV_inc((SV *) FSRPCERRORS), 0);

   for (currIdx = 0; currIdx < AFS_STATS_NUM_FS_XFER_OPS; currIdx++)
      my_cm_PrintXferTiming(currIdx, xferOpNames,
                            &(a_rpcP->fsXferTimes[currIdx]), FSXFERTIMES);

   hv_store(RPC, "fsXferTimes", 11, newRV_inc((SV *) FSXFERTIMES), 0);

   for (currIdx = 0; currIdx < AFS_STATS_NUM_CM_RPC_OPS; currIdx++)
      my_cm_PrintOpTiming(currIdx, cmOpNames, &(a_rpcP->cmRPCTimes[currIdx]),
                          CMRPCTIMES);

   hv_store(RPC, "cmRPCTimes", 10, newRV_inc((SV *) CMRPCTIMES), 0);

}


/*
 * from src/xstat/xstat_cm_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_cm_PrintFullPerfInfo(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
   /*Ptr to authentication stats */
   struct afs_stats_AuthentInfo *authentP;
   /*Ptr to access stats */
   struct afs_stats_AccessInfo *accessinfP;
   /*Correct #int32s */
   static afs_int32 fullPerfInt32s = (sizeof(struct afs_stats_CMFullPerf) >> 2);
   /*# int32s actually received */
   afs_int32 numInt32s;
   struct afs_stats_CMFullPerf *fullP;
   HV *DATA      = newHV();
   HV *PERF      = newHV();
   HV *RPC       = newHV();
   HV *AUTHENT   = newHV();
   HV *ACCESSINF = newHV();

   numInt32s = xstat_cm_Results->data.AFSCB_CollData_len;
   if (numInt32s != fullPerfInt32s) {
      warn("** Data size mismatch in performance collection!");
      warn("** Expecting %d, got %d\n", fullPerfInt32s, numInt32s);
      warn("** Version mismatch with Cache Manager\n");
      return;
   }
   fullP = (struct afs_stats_CMFullPerf *)
      (xstat_cm_Results->data.AFSCB_CollData_val);

   my_cm_PrintOverallPerfInfo(&(fullP->perf), PERF);
   hv_store(DATA, "perf", 4, newRV_inc((SV *) PERF), 0);
   my_PrintRPCPerfInfo(&(fullP->rpc), RPC);
   hv_store(DATA, "rpc", 3, newRV_inc((SV *) RPC), 0);

   authentP = &(fullP->authent);

   hv_store(AUTHENT, "curr_PAGs", 9, newSViv(authentP->curr_PAGs), 0);
   hv_store(AUTHENT, "curr_Records", 12, newSViv(authentP->curr_Records), 0);
   hv_store(AUTHENT, "curr_AuthRecords", 16,
            newSViv(authentP->curr_AuthRecords), 0);
   hv_store(AUTHENT, "curr_UnauthRecords", 18,
            newSViv(authentP->curr_UnauthRecords), 0);
   hv_store(AUTHENT, "curr_MaxRecordsInPAG", 20,
            newSViv(authentP->curr_MaxRecordsInPAG), 0);
   hv_store(AUTHENT, "curr_LongestChain", 17,
            newSViv(authentP->curr_LongestChain), 0);
   hv_store(AUTHENT, "PAGCreations", 12, newSViv(authentP->PAGCreations), 0);
   hv_store(AUTHENT, "TicketUpdates", 13, newSViv(authentP->TicketUpdates),
            0);
   hv_store(AUTHENT, "HWM_PAGs", 8, newSViv(authentP->HWM_PAGs), 0);
   hv_store(AUTHENT, "HWM_Records", 11, newSViv(authentP->HWM_Records), 0);
   hv_store(AUTHENT, "HWM_MaxRecordsInPAG", 19,
            newSViv(authentP->HWM_MaxRecordsInPAG), 0);
   hv_store(AUTHENT, "HWM_LongestChain", 16,
            newSViv(authentP->HWM_LongestChain), 0);
   hv_store(DATA, "authent", 7, newRV_inc((SV *) AUTHENT), 0);

   accessinfP = &(fullP->accessinf);

   hv_store(ACCESSINF, "unreplicatedRefs", 16,
            newSViv(accessinfP->unreplicatedRefs), 0);
   hv_store(ACCESSINF, "replicatedRefs", 14,
            newSViv(accessinfP->replicatedRefs), 0);
   hv_store(ACCESSINF, "numReplicasAccessed", 19,
            newSViv(accessinfP->numReplicasAccessed), 0);
   hv_store(ACCESSINF, "maxReplicasPerRef", 17,
            newSViv(accessinfP->maxReplicasPerRef), 0);
   hv_store(ACCESSINF, "refFirstReplicaOK", 17,
            newSViv(accessinfP->refFirstReplicaOK), 0);
   hv_store(DATA, "accessinf", 9, newRV_inc((SV *) ACCESSINF), 0);

   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_cm_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

void
my_cm_PrintPerfInfo(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
   /*Correct # int32s to rcv */
   static afs_int32 perfInt32s = (sizeof(struct afs_stats_CMPerf) >> 2);
   /*# int32words received */
   afs_int32 numInt32s;
   /*Ptr to performance stats */
   struct afs_stats_CMPerf *perfP;
   HV *DATA = newHV();

   numInt32s = xstat_cm_Results->data.AFSCB_CollData_len;
   if (numInt32s != perfInt32s) {
      warn("** Data size mismatch in performance collection!");
      warn("** Expecting %d, got %d\n", perfInt32s, numInt32s);
      warn("** Version mismatch with Cache Manager\n");
      return;
   }
   perfP = (struct afs_stats_CMPerf *)
      (xstat_cm_Results->data.AFSCB_CollData_val);

   my_cm_PrintOverallPerfInfo(perfP, DATA);
   hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}


/*
 * from src/xstat/xstat_cm_test.c
 *    ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
 */

int
my_xstat_CM_Handler(xstat_cm_Results, xstat_cm_numServers, index, buffer,
                    argp)
   struct xstat_cm_ProbeResults xstat_cm_Results;
   int xstat_cm_numServers;

src/Monitor.xs  view on Meta::CPAN

    short showLong=0;
    int version_flag=0;
    afs_int32 length=64;
    char version[64];
    char buffer[240]; /* for error messages */

    afs_uint32 supportedDebugValues = 0;
    afs_uint32 supportedStatValues = 0;
    afs_uint32 supportedConnValues = 0;
    afs_uint32 supportedPeerValues = 0;
    afs_int32 nextconn = 0;
    afs_int32 nextpeer = 0;

  size = hv_iterinit(args);
  /* fprintf(STDERR, "Parsing args now: %d\n", size); */
  while (size--) {
    char *flag;
    entry = hv_iternext(args);
    key = hv_iterkey(entry, &keylen);
    value = hv_iterval(args, entry);
    flag = key;
    /* fprintf(STDERR, "size = %d, format: got flag %s\n", size, key); */

    switch (*flag) {
    case 'a':
        if (memcmp( flag, "allconnections", 14) == 0 ) {
            allconns = (int) SvIV(value);
        }
        break;

    case 'l':
        if (memcmp( flag, "long", 4) == 0 ) {
            showLong = (int) SvIV(value);
        }
        break;

    case 'n':
        if (memcmp( flag, "nodally", 7) == 0 ) {
            nodally = (int) SvIV(value);
        } else if (memcmp( flag, "noconns", 7) == 0 ) {
            noConns = (int) SvIV(value);
        }
        break;

    case 'o':
        if (memcmp( flag, "onlyserver", 10) == 0 ) {
            onlyServer = (int) SvIV(value);
        } else if (memcmp( flag, "onlyclient", 10) == 0 ) {
            onlyClient = (int) SvIV(value);
        } else if (memcmp( flag, "onlyhost", 8) == 0 ) {
            char *name = (char *) SvPV(value, PL_na);
        struct hostent *th;
        th = hostutil_GetHostByName(name);
        if (!th) {
            sprintf(buffer, "rxdebug: host %s not found in host table", name);
            BSETCODE(-1, buffer);
            XSRETURN_UNDEF;
        }
        memcpy(&onlyHost, th->h_addr, sizeof(afs_int32));

        } else if (memcmp( flag, "onlyauth", 8) == 0 ) {
            char *name = (char *) SvPV(value, PL_na);
            if (strcmp (name, "clear") == 0) onlyAuth = 0;
            else if (strcmp (name, "auth") == 0) onlyAuth = 1;
            else if (strcmp (name, "crypt") == 0) onlyAuth = 2;
            else if ((strcmp (name, "null") == 0) ||
                     (strcmp (name, "none") == 0) ||
                     (strncmp (name, "noauth", 6) == 0) ||
                     (strncmp (name, "unauth", 6) == 0)) onlyAuth = -1;
            else {
              sprintf (buffer, "Unknown authentication level: %s", name);
              BSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }

        } else if (memcmp( flag, "onlyport", 8) == 0 ) {
            char *name = (char *) SvPV(value, PL_na);
            if ((onlyPort = rxdebug_PortNumber(name)) == -1)
              onlyPort = rxdebug_PortName(name);
            if (onlyPort == -1) {
              sprintf(buffer, "rxdebug: can't resolve port name %s", name);
              VSETCODE(-1, buffer);
              XSRETURN_UNDEF;
            }
        }

        break;

    case 'p':
        if (memcmp( flag, "port", 4) == 0 ) {
            portName = (char *) SvPV(value, PL_na);
        } else if (memcmp( flag, "peers", 5) == 0 ) {
           showPeers  = (int) SvIV(value);
        }
        break;

    case 'r':
        if (memcmp( flag, "rxstats", 7) == 0 ) {
            rxstats = (int) SvIV(value);
        }
        break;

    case 's':
        if (memcmp( flag, "servers", 7) == 0 ) {
            hostName = (char *) SvPV(value, PL_na);
        }
        break;

    case 'v':
        if (memcmp( flag, "version", 7) == 0 ) {
            version_flag = (int) SvIV(value);
        }
        break;

    default:
        break;
    } /* switch */
  } /* while */
  /*  fprintf(STDERR, "Done parsing args\n\n"); */

    /* lookup host */
    if (hostName) {
      th = hostutil_GetHostByName(hostName);
      if (!th) {
        sprintf(buffer, "rxdebug: host %s not found in host table", hostName);
        VSETCODE(-1, buffer);
        XSRETURN_UNDEF;
      }
      memcpy(&host, th->h_addr, sizeof(afs_int32));
    }
    else host = htonl(0x7f000001);    /* IP localhost */



( run in 1.129 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )