AFS-Monitor

 view release on metacpan or  search on metacpan

examples/xstat_cm_test  view on Meta::CPAN


  if ($showdump) {
    local $Data::Dumper::Quotekeys = 0;
    local $Data::Dumper::Sortkeys = 1;
    local $Data::Dumper::Indent = 1;
    local $Data::Dumper::Maxdepth = 2;
    local $Data::Dumper::Varname = "xstat_cm_test";
    print Dumper($info);
  }

  if ($formatted) {
    foreach my $host (@$info) {
      if ($host->{probeOK} == 0) {
        printf("CM_Handler: Probe 1, collection %d to CM on '%s' failed\n",
                $host->{collectionNumber},
                $host->{hostName});
        return;
      }
      if ($host->{collectionNumber} == constant("AFSCB_XSTATSCOLL_CALL_INFO")) {
        PrintCallInfo($host);
      } elsif ($host->{collectionNumber} == constant("AFSCB_XSTATSCOLL_PERF_INFO")) {
        PrintPerfInfo($host);
      } elsif ($host->{collectionNumber} == constant("AFSCB_XSTATSCOLL_FULL_PERF_INFO")) {
        PrintFullPerfInfo($host);
      } else {
        printf "** Unknown collection: %d\n", $host->{collectionNumber};
      }
    }
  }
}


sub PrintPerfInfo {
  my $host = shift;

  printf("AFSCB_XSTATSCOLL_PERF_INFO (coll %d) for CM %s\n[Probe 1, %s]\n\n",
          $host->{collectionNumber},
          $host->{hostName},
          scalar localtime $host->{probeTime});

  PrintOverallPerfInfo($host->{data});
}


sub PrintFullPerfInfo {
  my $host = shift;

  printf("AFSCB_XSTATSCOLL_FULL_PERF_INFO (coll %d) for CM %s\n[Probe 1, %s]\n\n",
          $host->{collectionNumber},
          $host->{hostName},
          scalar localtime $host->{probeTime});

  print "Overall Performance Info:\n-------------------------\n";

  PrintOverallPerfInfo($host->{data}->{perf});

  print "\n";

  PrintRPCPerfInfo($host->{data}->{rpc});

  my $authentP = $host->{data}->{authent};
  print "\nAuthentication info:\n--------------------\n";

  printf("\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});
  printf("\t%d PAG creations, %d tkt updates\n",
          $authentP->{PAGCreations},
          $authentP->{TicketUpdates});
  printf("\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});

  my $accessinfP = $host->{data}->{accessinf};
  print "\n[Un]replicated accesses:\n------------------------\n";
  printf("\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});
}


sub PrintOverallPerfInfo {
  my $perf = shift;

  printf "\t%10d numPerfCalls\n", $perf->{numPerfCalls};

  printf "\t%10d epoch\n",	 $perf->{epoch};
  printf "\t%10d numCellsVisible\n", $perf->{numCellsVisible};
  printf "\t%10d numCellsContacted\n", $perf->{numCellsContacted};
  printf "\t%10d dlocalAccesses\n", $perf->{dlocalAccesses};
  printf "\t%10d vlocalAccesses\n", $perf->{vlocalAccesses};
  printf "\t%10d dremoteAccesses\n", $perf->{dremoteAccesses};
  printf "\t%10d vremoteAccesses\n", $perf->{vremoteAccesses};
  printf "\t%10d cacheNumEntries\n", $perf->{cacheNumEntries};
  printf "\t%10d cacheBlocksTotal\n", $perf->{cacheBlocksTotal};
  printf "\t%10d cacheBlocksInUse\n", $perf->{cacheBlocksInUse};
  printf "\t%10d cacheBlocksOrig\n", $perf->{cacheBlocksOrig};
  printf "\t%10d cacheMaxDirtyChunks\n", $perf->{cacheMaxDirtyChunks};
  printf "\t%10d cacheCurrDirtyChunks\n", $perf->{cacheCurrDirtyChunks};
  printf "\t%10d dcacheHits\n", $perf->{dcacheHits};
  printf "\t%10d vcacheHits\n", $perf->{vcacheHits};
  printf "\t%10d dcacheMisses\n", $perf->{dcacheMisses};
  printf "\t%10d vcacheMisses\n", $perf->{vcacheMisses};
  printf "\t%10d cacheFilesReused\n", $perf->{cacheFilesReused};
  printf "\t%10d vcacheXAllocs\n", $perf->{vcacheXAllocs};
  printf "\t%10d dcacheXAllocs\n", $perf->{dcacheXAllocs};

  printf "\t%10d bufAlloced\n", $perf->{bufAlloced};
  printf "\t%10d bufHits\n",	 $perf->{bufHits};
  printf "\t%10d bufMisses\n", $perf->{bufMisses};
  printf "\t%10d bufFlushDirty\n", $perf->{bufFlushDirty};

  printf "\t%10d LargeBlocksActive\n", $perf->{LargeBlocksActive};
  printf "\t%10d LargeBlocksAlloced\n", $perf->{LargeBlocksAlloced};
  printf "\t%10d SmallBlocksActive\n", $perf->{SmallBlocksActive};
  printf "\t%10d SmallBlocksAlloced\n", $perf->{SmallBlocksAlloced};
  printf "\t%10d OutStandingMemUsage\n", $perf->{OutStandingMemUsage};
  printf "\t%10d OutStandingAllocs\n", $perf->{OutStandingAllocs};
  printf "\t%10d CallBackAlloced\n", $perf->{CallBackAlloced};
  printf "\t%10d CallBackFlushes\n", $perf->{CallBackFlushes};
  printf "\t%10d CallBackLoops\n", $perf->{cbloops};

  printf "\t%10d srvRecords\n", $perf->{srvRecords};
  printf "\t%10d srvNumBuckets\n", $perf->{srvNumBuckets};
  printf "\t%10d srvMaxChainLength\n", $perf->{srvMaxChainLength};
  printf "\t%10d srvMaxChainLengthHWM\n", $perf->{srvMaxChainLengthHWM};
  printf "\t%10d srvRecordsHWM\n", $perf->{srvRecordsHWM};

  printf "\t%10d sysName_ID\n", $perf->{sysName_ID};



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