AFS-Monitor
view release on metacpan or search on metacpan
src/Monitor.xs view on Meta::CPAN
#define THRESH_VAR_NAME_LEN 80 /* THRESHOLD STRUCTURE DEFINITIONS */
#define THRESH_VAR_LEN 16
#define NUM_FS_STAT_ENTRIES 271 /* number of file server statistics
* entries to display */
#define FS_STAT_STRING_LEN 14 /* max length of each string above */
#define NUM_CM_STAT_ENTRIES 571 /* number of cache manager statistics
* entries to display */
#define CM_STAT_STRING_LEN 14 /* max length of each string above */
#define FS_NUM_DATA_CATEGORIES 9 /* # of fs categories */
#define CM_NUM_DATA_CATEGORIES 16 /* # of cm categories */
/*
* from src/xstat/xstat_fs.c
* ("$Header: /afs/slac/g/scs/slur/Repository/AFSDebug/Debug/src/Monitor.xs,v 1.2 2006/07/05 22:25:10 alfw Exp $");
*
/*
* We have to pass a port to Rx to start up our callback listener
* service, but 7001 is already taken up by the Cache Manager. So,
* we make up our own.
*/
#define XSTAT_FS_CBPORT 7101
/*
* 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 $");
*/
static char *fsOpNames[] = {
"FetchData",
"FetchACL",
"FetchStatus",
"StoreData",
"StoreACL",
"StoreStatus",
"RemoveFile",
"CreateFile",
"Rename",
"Symlink",
"Link",
"MakeDir",
"RemoveDir",
"SetLock",
"ExtendLock",
"ReleaseLock",
"GetStatistics",
"GiveUpCallbacks",
"GetVolumeInfo",
"GetVolumeStatus",
"SetVolumeStatus",
"GetRootVolume",
"CheckToken",
"GetTime",
"NGetVolumeInfo",
"BulkStatus",
"XStatsVersion",
"GetXStats",
"XLookup" /* from xstat/xstat_cm_test.c */
};
/*
* 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 $");
*/
static char *cmOpNames[] = {
"CallBack",
"InitCallBackState",
"Probe",
"GetLock",
"GetCE",
"XStatsVersion",
"GetXStats"
};
/*
* 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 $");
*/
static char *xferOpNames[] = {
"FetchData",
"StoreData"
};
/*
* from src/afsmonitor/afsmonitor.h
*
*/
/* structure of each threshold item */
struct Threshold {
char itemName[THRESH_VAR_NAME_LEN]; /* field name */
int index; /* positional index */
char threshVal[THRESH_VAR_LEN]; /* user provided threshold value */
char handler[256]; /* user provided ovf handler */
};
/*
* from src/afsmonitor/afsmonitor.h
*
*/
/* structures to store info of hosts to be monitored */
struct afsmon_hostEntry {
char hostName[HOST_NAME_LEN]; /* fs or cm host name */
int numThresh; /* number of thresholds for this host */
struct Threshold *thresh; /* ptr to threshold entries */
struct afsmon_hostEntry *next;
};
/*
* from src/afsmonitor/afsmonitor.h
src/Monitor.xs view on Meta::CPAN
*/
curr_conn = xstat_fs_ConnInfo;
for (conn_idx = 0; conn_idx < xstat_fs_numServers; conn_idx++) {
if (curr_conn->rxconn != (struct rx_connection *) NULL) {
rx_DestroyConnection(curr_conn->rxconn);
curr_conn->rxconn = (struct rx_connection *) NULL;
}
curr_conn++;
} /*for each xstat_fs connection */
} /*xstat_fs connection structure exists */
} /*Legal number of servers */
/*
* If asked to, release the space we've allocated.
*/
if (a_releaseMem) {
if (xstat_fs_ConnInfo != (struct xstat_fs_ConnectionInfo *) NULL)
free(xstat_fs_ConnInfo);
}
/*
* Return the news, whatever it is.
*/
return (code);
} /* my_xstat_fs_Cleanup() */
/*
* 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_UpDownStats(a_upDownP, cm_outFD)
struct afs_stats_SrvUpDownInfo *a_upDownP; /*Ptr to server up/down info */
FILE *cm_outFD;
{ /*Print_cm_UpDownStats */
/*
* First, print the simple values.
*/
fprintf(cm_outFD, "\t\t%10d numTtlRecords\n", a_upDownP->numTtlRecords);
fprintf(cm_outFD, "\t\t%10d numUpRecords\n", a_upDownP->numUpRecords);
fprintf(cm_outFD, "\t\t%10d numDownRecords\n", a_upDownP->numDownRecords);
fprintf(cm_outFD, "\t\t%10d sumOfRecordAges\n",
a_upDownP->sumOfRecordAges);
fprintf(cm_outFD, "\t\t%10d ageOfYoungestRecord\n",
a_upDownP->ageOfYoungestRecord);
fprintf(cm_outFD, "\t\t%10d ageOfOldestRecord\n",
a_upDownP->ageOfOldestRecord);
fprintf(cm_outFD, "\t\t%10d numDowntimeIncidents\n",
a_upDownP->numDowntimeIncidents);
fprintf(cm_outFD, "\t\t%10d numRecordsNeverDown\n",
a_upDownP->numRecordsNeverDown);
fprintf(cm_outFD, "\t\t%10d maxDowntimesInARecord\n",
a_upDownP->maxDowntimesInARecord);
fprintf(cm_outFD, "\t\t%10d sumOfDowntimes\n", a_upDownP->sumOfDowntimes);
fprintf(cm_outFD, "\t\t%10d shortestDowntime\n",
a_upDownP->shortestDowntime);
fprintf(cm_outFD, "\t\t%10d longestDowntime\n",
a_upDownP->longestDowntime);
/*
* Now, print the array values.
*/
fprintf(cm_outFD, "\t\tDowntime duration distribution:\n");
fprintf(cm_outFD, "\t\t\t%8d: 0 min .. 10 min\n",
a_upDownP->downDurations[0]);
fprintf(cm_outFD, "\t\t\t%8d: 10 min .. 30 min\n",
a_upDownP->downDurations[1]);
fprintf(cm_outFD, "\t\t\t%8d: 30 min .. 1 hr\n",
a_upDownP->downDurations[2]);
fprintf(cm_outFD, "\t\t\t%8d: 1 hr .. 2 hr\n",
a_upDownP->downDurations[3]);
fprintf(cm_outFD, "\t\t\t%8d: 2 hr .. 4 hr\n",
a_upDownP->downDurations[4]);
fprintf(cm_outFD, "\t\t\t%8d: 4 hr .. 8 hr\n",
a_upDownP->downDurations[5]);
fprintf(cm_outFD, "\t\t\t%8d: > 8 hr\n", a_upDownP->downDurations[6]);
fprintf(cm_outFD, "\t\tDowntime incident distribution:\n");
fprintf(cm_outFD, "\t\t\t%8d: 0 times\n", a_upDownP->downIncidents[0]);
fprintf(cm_outFD, "\t\t\t%8d: 1 time\n", a_upDownP->downIncidents[1]);
fprintf(cm_outFD, "\t\t\t%8d: 2 .. 5 times\n",
a_upDownP->downIncidents[2]);
fprintf(cm_outFD, "\t\t\t%8d: 6 .. 10 times\n",
a_upDownP->downIncidents[3]);
fprintf(cm_outFD, "\t\t\t%8d: 10 .. 50 times\n",
a_upDownP->downIncidents[4]);
fprintf(cm_outFD, "\t\t\t%8d: > 50 times\n", a_upDownP->downIncidents[5]);
} /* my_Print_cm_UpDownStats() */
/*
* 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_XferTiming(a_opIdx, a_opNames, a_xferP, cm_outFD)
int a_opIdx;
char *a_opNames[];
struct afs_stats_xferData *a_xferP;
FILE *cm_outFD;
{ /*Print_cm_XferTiming */
fprintf(cm_outFD,
"%s: %d xfers (%d OK), time sum=%d.%06d, min=%d.%06d, max=%d.%06d\n",
a_opNames[a_opIdx], a_xferP->numXfers, a_xferP->numSuccesses,
a_xferP->sumTime.tv_sec, a_xferP->sumTime.tv_usec,
a_xferP->minTime.tv_sec, a_xferP->minTime.tv_usec,
a_xferP->maxTime.tv_sec, a_xferP->maxTime.tv_usec);
fprintf(cm_outFD, "\t[bytes: sum=%d, min=%d, max=%d]\n", a_xferP->sumBytes,
a_xferP->minBytes, a_xferP->maxBytes);
fprintf(cm_outFD,
"\t[buckets: 0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d 6: %d, 7: %d, 8: %d]\n",
a_xferP->count[0], a_xferP->count[1], a_xferP->count[2],
a_xferP->count[3], a_xferP->count[4], a_xferP->count[5],
src/Monitor.xs view on Meta::CPAN
/*
* Take care of all Rx connections first. Check to see that the
* server count is a legal value.
*/
if (fsprobe_numServers <= 0) {
sprintf(buffer,
"[%s] Illegal number of servers to clean up (fsprobe_numServers = %d)",
rn, fsprobe_numServers);
code = -1;
}
else {
if (fsprobe_ConnInfo != (struct fsprobe_ConnectionInfo *) NULL) {
/*
* The fsprobe connection structure array exists. Go through it
* and close up any Rx connections it holds.
*/
curr_conn = fsprobe_ConnInfo;
for (conn_idx = 0; conn_idx < fsprobe_numServers; conn_idx++) {
if (curr_conn->rxconn != (struct rx_connection *) NULL) {
rx_DestroyConnection(curr_conn->rxconn);
curr_conn->rxconn = (struct rx_connection *) NULL;
}
if (curr_conn->rxVolconn != (struct rx_connection *) NULL) {
rx_DestroyConnection(curr_conn->rxVolconn);
curr_conn->rxVolconn = (struct rx_connection *) NULL;
}
curr_conn++;
} /*for each fsprobe connection */
} /*fsprobe connection structure exists */
} /*Legal number of servers */
/*
* Now, release all the space we've allocated
*/
if (fsprobe_ConnInfo != (struct fsprobe_ConnectionInfo *) NULL)
free(fsprobe_ConnInfo);
if (fsprobe_Results->stats != (struct ProbeViceStatistics *) NULL)
free(fsprobe_Results->stats);
if (fsprobe_Results->probeOK != (int *) NULL)
free(fsprobe_Results->probeOK);
/*
* Return the news, whatever it is.
*/
return (code);
}
/*
* from src/fsprobe/fsprobe.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_fsprobe_Init(fsprobe_Results, fsprobe_ConnInfo, a_numServers,
a_socketArray, RETVAL, scout_debugfd, buffer)
struct fsprobe_ProbeResults *fsprobe_Results; /*Latest probe results */
struct fsprobe_ConnectionInfo **fsprobe_ConnInfo; /*Ptr to connection array */
int a_numServers;
struct sockaddr_in *a_socketArray;
AV *RETVAL;
FILE *scout_debugfd;
char *buffer;
{
static char rn[] = "my_fsprobe_Init";
struct fsprobe_ConnectionInfo *curr_conn; /*Current connection */
int fsprobe_statsBytes; /*Num bytes in stats block */
int fsprobe_probeOKBytes; /*Num bytes in probeOK block */
int conn_err = 0, code = 0;
int curr_srv;
char *hostNameFound;
int PortToUse;
struct rx_securityClass *secobj;
struct rx_securityClass *CBsecobj;
struct rx_service *rxsrv_afsserver;
char buff2[256] = "";
struct rx_call *rxcall; /*Bogus param */
AFSCBFids *Fids_Array; /*Bogus param */
AFSCBs *CallBack_Array; /*Bogus param */
struct interfaceAddr *interfaceAddr; /*Bogus param */
if (scout_debugfd) {
fprintf(scout_debugfd, "[%s] Called\n", rn);
fflush(scout_debugfd);
}
if (a_numServers <= 0) {
sprintf(buffer, "[%s] Illegal number of servers: %d", rn, a_numServers);
return (-1);
}
if (a_socketArray == (struct sockaddr_in *) NULL) {
sprintf(buffer, "[%s] Null server socket array argument", rn);
return (-1);
}
memset(fsprobe_Results, 0, sizeof(struct fsprobe_ProbeResults));
rxcall = (struct rx_call *) NULL;
Fids_Array = (AFSCBFids *) NULL;
CallBack_Array = (AFSCBs *) NULL;
interfaceAddr = (struct interfaceAddr *) NULL;
SRXAFSCB_CallBack(rxcall, Fids_Array, CallBack_Array);
SRXAFSCB_InitCallBackState2(rxcall, interfaceAddr);
SRXAFSCB_Probe(rxcall);
*fsprobe_ConnInfo = (struct fsprobe_ConnectionInfo *)
malloc(a_numServers * sizeof(struct fsprobe_ConnectionInfo));
if (*fsprobe_ConnInfo == (struct fsprobe_ConnectionInfo *) NULL) {
sprintf(buffer,
"[%s] Can't allocate %d connection info structs (%d bytes)\n",
rn, a_numServers,
(a_numServers * sizeof(struct fsprobe_ConnectionInfo)));
src/Monitor.xs view on Meta::CPAN
hv_store(STATS, "WorkStations", strlen("WorkStations"),
newSViv(curr_stats->WorkStations), 0);
hv_store(STATS, "ActiveWorkStations", strlen("ActiveWorkStations"),
newSViv(curr_stats->ActiveWorkStations), 0);
hv_store(STATS, "Spare1", strlen("Spare1"),
newSViv(curr_stats->Spare1), 0);
hv_store(STATS, "Spare2", strlen("Spare2"),
newSViv(curr_stats->Spare2), 0);
hv_store(STATS, "Spare3", strlen("Spare3"),
newSViv(curr_stats->Spare3), 0);
hv_store(STATS, "Spare4", strlen("Spare4"),
newSViv(curr_stats->Spare4), 0);
hv_store(STATS, "Spare5", strlen("Spare5"),
newSViv(curr_stats->Spare5), 0);
hv_store(STATS, "Spare6", strlen("Spare6"),
newSViv(curr_stats->Spare6), 0);
hv_store(STATS, "Spare7", strlen("Spare7"),
newSViv(curr_stats->Spare7), 0);
hv_store(STATS, "Spare8", strlen("Spare8"),
newSViv(curr_stats->Spare8), 0);
DISKS = newAV();
curr_diskstat = (ViceDisk *) curr_stats->Disk;
j = 0;
for (curr_disk = 0; curr_disk < VOLMAXPARTS; curr_disk++) {
if (strncmp("/vice", curr_diskstat->Name, 5) == 0) {
DISK = newHV();
hv_store(DISK, "Name", 4, newSVpv(&curr_diskstat->Name[6], 0),
0);
hv_store(DISK, "TotalBlocks", 10,
newSViv(curr_diskstat->TotalBlocks), 0);
hv_store(DISK, "BlocksAvailable", 15,
newSViv(curr_diskstat->BlocksAvailable), 0);
av_store(DISKS, j, newRV_inc((SV *) DISK));
curr_diskstat++;
j++;
}
}
hv_store(STATS, "Disk", 4, newRV_inc((SV *) DISKS), 0);
hv_store(RESULTS, "stats", 5, newRV_inc((SV *) STATS), 0);
}
av_store(RETVAL, i, newRV_inc((SV *) RESULTS));
curr_stats++;
curr_probeOK++;
curr_conn++;
}
code =
my_fsprobe_Cleanup(&fsprobe_Results, fsprobe_ConnInfo, numServers,
scout_debugfd, buffer);
return code;
}
/* end of scout helper functions */
/* xstat_fs_test helper functions */
/*
* from src/xstat/xstat_fs_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_PrintOpTiming(int a_opIdx, struct fs_stats_opTimingData *a_opTimeP, HV *DATA)
{
HV *OPTIMING = newHV();
hv_store(OPTIMING, "sumTime", 7,
newSVnv(a_opTimeP->sumTime.tv_sec +
a_opTimeP->sumTime.tv_usec / 1000000.0), 0);
hv_store(OPTIMING, "sqrTime", 7,
newSVnv(a_opTimeP->sqrTime.tv_sec +
a_opTimeP->sqrTime.tv_usec / 1000000.0), 0);
hv_store(OPTIMING, "minTime", 7,
newSVnv(a_opTimeP->minTime.tv_sec +
a_opTimeP->minTime.tv_usec / 1000000.0), 0);
hv_store(OPTIMING, "maxTime", 7,
newSVnv(a_opTimeP->maxTime.tv_sec +
a_opTimeP->maxTime.tv_usec / 1000000.0), 0);
hv_store(OPTIMING, "numSuccesses", 12, newSViv(a_opTimeP->numSuccesses),
0);
hv_store(OPTIMING, "numOps", 6, newSViv(a_opTimeP->numOps), 0);
hv_store(DATA, fsOpNames[a_opIdx], strlen(fsOpNames[a_opIdx]),
newRV_inc((SV *) OPTIMING), 0);
}
/*
* from src/xstat/xstat_fs_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_PrintXferTiming(int a_opIdx, struct fs_stats_xferData *a_xferP, HV *DATA)
{
HV *XFERTIMING = newHV();
AV *COUNT = newAV();
int i;
hv_store(XFERTIMING, "sumTime", 7,
newSVnv(a_xferP->sumTime.tv_sec +
a_xferP->sumTime.tv_usec / 1000000.0), 0);
hv_store(XFERTIMING, "sqrTime", 7,
newSVnv(a_xferP->sqrTime.tv_sec +
a_xferP->sqrTime.tv_usec / 1000000.0), 0);
hv_store(XFERTIMING, "minTime", 7,
newSVnv(a_xferP->minTime.tv_sec +
a_xferP->minTime.tv_usec / 1000000.0), 0);
hv_store(XFERTIMING, "maxTime", 7,
newSVnv(a_xferP->maxTime.tv_sec +
a_xferP->maxTime.tv_usec / 1000000.0), 0);
hv_store(XFERTIMING, "numSuccesses", 12, newSViv(a_xferP->numSuccesses),
0);
hv_store(XFERTIMING, "numXfers", 8, newSViv(a_xferP->numXfers), 0);
hv_store(XFERTIMING, "sumBytes", 8, newSViv(a_xferP->sumBytes), 0);
hv_store(XFERTIMING, "minBytes", 8, newSViv(a_xferP->minBytes), 0);
hv_store(XFERTIMING, "maxBytes", 8, newSViv(a_xferP->maxBytes), 0);
for (i = 0; i <= 8; i++)
av_store(COUNT, i, newSViv(a_xferP->count[i]));
hv_store(XFERTIMING, "count", 5, newRV_inc((SV *) COUNT), 0);
hv_store(DATA, xferOpNames[a_opIdx], strlen(xferOpNames[a_opIdx]),
newRV_inc((SV *) XFERTIMING), 0);
}
/*
* from src/xstat/xstat_fs_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_PrintDetailedPerfInfo(struct fs_stats_DetailedStats *a_detP, HV *DATA)
{
int currIdx;
HV *OPTIMES = newHV();
HV *XFERS = newHV();
hv_store(DATA, "epoch", 5,
newSVnv(a_detP->epoch.tv_sec + a_detP->epoch.tv_usec / 1000000.0),
0);
for (currIdx = 0; currIdx < FS_STATS_NUM_RPC_OPS; currIdx++)
my_PrintOpTiming(currIdx, &(a_detP->rpcOpTimes[currIdx]), OPTIMES);
hv_store(DATA, "rpcOpTimes", 10, newRV_inc((SV *) OPTIMES), 0);
for (currIdx = 0; currIdx < FS_STATS_NUM_XFER_OPS; currIdx++)
my_PrintXferTiming(currIdx, &(a_detP->xferOpTimes[currIdx]), XFERS);
hv_store(DATA, "xferOpTimes", 11, newRV_inc((SV *) XFERS), 0);
}
/*
* from src/xstat/xstat_fs_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_PrintOverallPerfInfo(struct afs_PerfStats *a_ovP, HV *DATA)
{
hv_store(DATA, "numPerfCalls", strlen("numPerfCalls"),
newSViv(a_ovP->numPerfCalls), 0);
/*
* Vnode cache section.
*/
hv_store(DATA, "vcache_L_Entries", strlen("vcache_L_Entries"),
newSViv(a_ovP->vcache_L_Entries), 0);
hv_store(DATA, "vcache_L_Allocs", strlen("vcache_L_Allocs"),
newSViv(a_ovP->vcache_L_Allocs), 0);
hv_store(DATA, "vcache_L_Gets", strlen("vcache_L_Gets"),
newSViv(a_ovP->vcache_L_Gets), 0);
hv_store(DATA, "vcache_L_Reads", strlen("vcache_L_Reads"),
newSViv(a_ovP->vcache_L_Reads), 0);
hv_store(DATA, "vcache_L_Writes", strlen("vcache_L_Writes"),
newSViv(a_ovP->vcache_L_Writes), 0);
hv_store(DATA, "vcache_S_Entries", strlen("vcache_S_Entries"),
newSViv(a_ovP->vcache_S_Entries), 0);
hv_store(DATA, "vcache_S_Allocs", strlen("vcache_S_Allocs"),
newSViv(a_ovP->vcache_S_Allocs), 0);
hv_store(DATA, "vcache_S_Gets", strlen("vcache_S_Gets"),
newSViv(a_ovP->vcache_S_Gets), 0);
hv_store(DATA, "vcache_S_Reads", strlen("vcache_S_Reads"),
newSViv(a_ovP->vcache_S_Reads), 0);
hv_store(DATA, "vcache_S_Writes", strlen("vcache_S_Writes"),
newSViv(a_ovP->vcache_S_Writes), 0);
hv_store(DATA, "vcache_H_Entries", strlen("vcache_H_Entries"),
newSViv(a_ovP->vcache_H_Entries), 0);
hv_store(DATA, "vcache_H_Gets", strlen("vcache_H_Gets"),
newSViv(a_ovP->vcache_H_Gets), 0);
hv_store(DATA, "vcache_H_Replacements", strlen("vcache_H_Replacements"),
newSViv(a_ovP->vcache_H_Replacements), 0);
/*
* Directory package section.
*/
hv_store(DATA, "dir_Buffers", strlen("dir_Buffers"),
newSViv(a_ovP->dir_Buffers), 0);
hv_store(DATA, "dir_Calls", strlen("dir_Calls"),
newSViv(a_ovP->dir_Calls), 0);
hv_store(DATA, "dir_IOs", strlen("dir_IOs"), newSViv(a_ovP->dir_IOs), 0);
/*
* Rx section.
*/
hv_store(DATA, "rx_packetRequests", strlen("rx_packetRequests"),
newSViv(a_ovP->rx_packetRequests), 0);
hv_store(DATA, "rx_noPackets_RcvClass", strlen("rx_noPackets_RcvClass"),
newSViv(a_ovP->rx_noPackets_RcvClass), 0);
hv_store(DATA, "rx_noPackets_SendClass", strlen("rx_noPackets_SendClass"),
newSViv(a_ovP->rx_noPackets_SendClass), 0);
hv_store(DATA, "rx_noPackets_SpecialClass",
src/Monitor.xs view on Meta::CPAN
hv_store(DATA, "rx_totalRtt_Usec", strlen("rx_totalRtt_Usec"),
newSViv(a_ovP->rx_totalRtt_Usec), 0);
hv_store(DATA, "rx_minRtt_Sec", strlen("rx_minRtt_Sec"),
newSViv(a_ovP->rx_minRtt_Sec), 0);
hv_store(DATA, "rx_minRtt_Usec", strlen("rx_minRtt_Usec"),
newSViv(a_ovP->rx_minRtt_Usec), 0);
hv_store(DATA, "rx_maxRtt_Sec", strlen("rx_maxRtt_Sec"),
newSViv(a_ovP->rx_maxRtt_Sec), 0);
hv_store(DATA, "rx_maxRtt_Usec", strlen("rx_maxRtt_Usec"),
newSViv(a_ovP->rx_maxRtt_Usec), 0);
hv_store(DATA, "rx_nRttSamples", strlen("rx_nRttSamples"),
newSViv(a_ovP->rx_nRttSamples), 0);
hv_store(DATA, "rx_nServerConns", strlen("rx_nServerConns"),
newSViv(a_ovP->rx_nServerConns), 0);
hv_store(DATA, "rx_nClientConns", strlen("rx_nClientConns"),
newSViv(a_ovP->rx_nClientConns), 0);
hv_store(DATA, "rx_nPeerStructs", strlen("rx_nPeerStructs"),
newSViv(a_ovP->rx_nPeerStructs), 0);
hv_store(DATA, "rx_nCallStructs", strlen("rx_nCallStructs"),
newSViv(a_ovP->rx_nCallStructs), 0);
hv_store(DATA, "rx_nFreeCallStructs", strlen("rx_nFreeCallStructs"),
newSViv(a_ovP->rx_nFreeCallStructs), 0);
#ifndef NOAFS_XSTATSCOLL_CBSTATS
hv_store(DATA, "rx_nBusies", strlen("rx_nBusies"),
newSViv(a_ovP->rx_nBusies), 0);
hv_store(DATA, "fs_nBusies", strlen("fs_nBusies"),
newSViv(a_ovP->fs_nBusies), 0);
hv_store(DATA, "fs_GetCapabilities", strlen("fs_GetCapabilities"),
newSViv(a_ovP->fs_nGetCaps), 0);
#endif
/*
* Host module fields.
*/
hv_store(DATA, "host_NumHostEntries", strlen("host_NumHostEntries"),
newSViv(a_ovP->host_NumHostEntries), 0);
hv_store(DATA, "host_HostBlocks", strlen("host_HostBlocks"),
newSViv(a_ovP->host_HostBlocks), 0);
hv_store(DATA, "host_NonDeletedHosts", strlen("host_NonDeletedHosts"),
newSViv(a_ovP->host_NonDeletedHosts), 0);
hv_store(DATA, "host_HostsInSameNetOrSubnet",
strlen("host_HostsInSameNetOrSubnet"),
newSViv(a_ovP->host_HostsInSameNetOrSubnet), 0);
hv_store(DATA, "host_HostsInDiffSubnet", strlen("host_HostsInDiffSubnet"),
newSViv(a_ovP->host_HostsInDiffSubnet), 0);
hv_store(DATA, "host_HostsInDiffNetwork",
strlen("host_HostsInDiffNetwork"),
newSViv(a_ovP->host_HostsInDiffNetwork), 0);
hv_store(DATA, "host_NumClients", strlen("host_NumClients"),
newSViv(a_ovP->host_NumClients), 0);
hv_store(DATA, "host_ClientBlocks", strlen("host_ClientBlocks"),
newSViv(a_ovP->host_ClientBlocks), 0);
hv_store(DATA, "sysname_ID", strlen("sysname_ID"),
newSViv(a_ovP->sysname_ID), 0);
}
/*
* from src/xstat/xstat_fs_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_PrintCallInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
int numInt32s;
afs_int32 *currInt32;
register int i;
char temp[100];
HV *DATA = newHV();
numInt32s = xstat_fs_Results->data.AFS_CollData_len;
hv_store(DATA, "AFS_CollData_len", 16, newSViv(numInt32s), 0);
currInt32 = (afs_int32 *) (xstat_fs_Results->data.AFS_CollData_val);
for (i = 0; i < numInt32s; i++) {
sprintf(temp, "%d", i);
hv_store(DATA, temp, strlen(temp), newSViv(*currInt32++), 0);
}
hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}
/*
* from src/xstat/xstat_fs_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_PrintPerfInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
/* Correct # int32s to rcv */
static afs_int32 perfInt32s = (sizeof(struct afs_PerfStats) >> 2);
/* # int32words received */
afs_int32 numInt32s;
/* Ptr to performance stats */
struct afs_PerfStats *perfP;
HV *DATA = newHV();
numInt32s = xstat_fs_Results->data.AFS_CollData_len;
if (numInt32s != perfInt32s) {
warn("** Data size mismatch in performance collection!");
warn("** Expecting %d, got %d\n", perfInt32s, numInt32s);
return;
}
perfP = (struct afs_PerfStats *)
(xstat_fs_Results->data.AFS_CollData_val);
my_PrintOverallPerfInfo(perfP, DATA);
hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}
/*
* from src/xstat/xstat_fs_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_fs_PrintFullPerfInfo(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
/* Correct # int32s to rcv */
static afs_int32 fullPerfInt32s = (sizeof(struct fs_stats_FullPerfStats) >> 2);
/* # int32words received */
afs_int32 numInt32s;
/* Ptr to full perf stats */
struct fs_stats_FullPerfStats *fullPerfP;
HV *DATA = newHV();
numInt32s = xstat_fs_Results->data.AFS_CollData_len;
if (numInt32s != fullPerfInt32s) {
warn("** Data size mismatch in full performance collection!");
warn("** Expecting %d, got %d\n", fullPerfInt32s, numInt32s);
return;
}
fullPerfP = (struct fs_stats_FullPerfStats *)
(xstat_fs_Results->data.AFS_CollData_val);
my_PrintOverallPerfInfo(&(fullPerfP->overall), DATA);
my_PrintDetailedPerfInfo(&(fullPerfP->det), DATA);
hv_store(HOSTINFO, "data", 4, newRV_inc((SV *) DATA), 0);
}
/*
* from src/xstat/xstat_fs_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 $");
*/
static char *CbCounterStrings[] = {
"DeleteFiles",
"DeleteCallBacks",
"BreakCallBacks",
"AddCallBack",
"GotSomeSpaces",
"DeleteAllCallBacks",
"nFEs", "nCBs", "nblks",
"CBsTimedOut",
"nbreakers",
"GSS1", "GSS2", "GSS3", "GSS4", "GSS5"
};
/*
* from src/xstat/xstat_fs_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_fs_PrintCbCounters(struct xstat_fs_ProbeResults *xstat_fs_Results, HV *HOSTINFO)
{
int numInt32s = sizeof(CbCounterStrings)/sizeof(char *);
int i;
afs_uint32 *val = xstat_fs_Results->data.AFS_CollData_val;
HV *DATA = newHV();
if (numInt32s > xstat_fs_Results->data.AFS_CollData_len)
numInt32s = xstat_fs_Results->data.AFS_CollData_len;
for (i=0; i<numInt32s; i++) {
hv_store(DATA, CbCounterStrings[i], strlen(CbCounterStrings[i]), newSViv(val[i]), 0);
}
hv_store(HOSTINFO, "CbCounters", 10, newRV_inc((SV *) DATA), 0);
}
/*
* from src/xstat/xstat_fs_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_FS_Handler(xstat_fs_Results, xstat_fs_numServers, index, buffer,
argp)
struct xstat_fs_ProbeResults xstat_fs_Results;
int xstat_fs_numServers;
int index;
char *buffer;
va_list argp;
{
AV *RETVAL = va_arg(argp, AV *);
HV *HOSTINFO = newHV();
hv_store(HOSTINFO, "probeOK", 7, newSViv(xstat_fs_Results.probeOK ? 0 : 1),
0);
hv_store(HOSTINFO, "hostName", 8,
newSVpv(xstat_fs_Results.connP->hostName, 0), 0);
hv_store(HOSTINFO, "collectionNumber", 16,
newSViv(xstat_fs_Results.collectionNumber), 0);
hv_store(HOSTINFO, "probeTime", 9, newSViv(xstat_fs_Results.probeTime), 0);
if (xstat_fs_Results.probeOK == 0) {
switch (xstat_fs_Results.collectionNumber) {
case AFS_XSTATSCOLL_CALL_INFO:
my_PrintCallInfo(&xstat_fs_Results, HOSTINFO);
break;
case AFS_XSTATSCOLL_PERF_INFO:
my_PrintPerfInfo(&xstat_fs_Results, HOSTINFO);
break;
case AFS_XSTATSCOLL_FULL_PERF_INFO:
my_fs_PrintFullPerfInfo(&xstat_fs_Results, HOSTINFO);
break;
#ifndef NOAFS_XSTATSCOLL_CBSTATS
case AFS_XSTATSCOLL_CBSTATS:
my_fs_PrintCbCounters(&xstat_fs_Results, HOSTINFO);
break;
#endif
default:
sprintf(buffer, "** Unknown collection: %d",
xstat_fs_Results.collectionNumber);
return (-1);
}
}
av_store(RETVAL, index, newRV_inc((SV *) HOSTINFO));
return (0);
}
/* end of xstat_fs_test helper functions */
/* xstat_cm_test helper functions */
/*
* 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_print_cmCallStats(struct xstat_cm_ProbeResults *xstat_cm_Results, HV *HOSTINFO)
{
struct afs_CMStats *cmp;
HV *DATA = newHV();
char *data_name;
cmp = (struct afs_CMStats *)(xstat_cm_Results->data.AFSCB_CollData_val);
data_name = "afs_init";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_init), 0);
data_name = "gop_rdwr";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_gop_rdwr), 0);
data_name = "aix_gnode_rele";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_aix_gnode_rele), 0);
data_name = "gettimeofday";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_gettimeofday), 0);
data_name = "m_cpytoc";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_m_cpytoc), 0);
data_name = "aix_vattr_null";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_aix_vattr_null), 0);
data_name = "afs_gn_frunc";
hv_store(DATA, "afs_gn_ftrunc", strlen("afs_gn_ftrunc"),
newSViv(cmp->callInfo.C_afs_gn_ftrunc), 0);
data_name = "afs_gn_rdwr";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_rdwr), 0);
data_name = "afs_gn_ioctl";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_ioctl), 0);
data_name = "afs_gn_locktl";
hv_store(DATA, "afs_gn_lockctl", strlen("afs_gn_lockctl"),
newSViv(cmp->callInfo.C_afs_gn_lockctl), 0);
data_name = "afs_gn_readlink";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_readlink), 0);
data_name = "afs_gn_readdir";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_readdir), 0);
data_name = "afs_gn_select";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_select), 0);
data_name = "afs_gn_strategy";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_strategy), 0);
data_name = "afs_gn_symlink";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_symlink), 0);
data_name = "afs_gn_revoke";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_gn_revoke), 0);
src/Monitor.xs view on Meta::CPAN
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_AddPag), 0);
data_name = "PagInCred";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_PagInCred), 0);
data_name = "afs_getgroups";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_getgroups), 0);
data_name = "afs_page_in";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_page_in), 0);
data_name = "afs_page_out";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_page_out), 0);
data_name = "afs_AdvanceFD";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_AdvanceFD), 0);
data_name = "afs_lockf";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_lockf), 0);
data_name = "afs_xsetgroups";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_xsetgroups), 0);
data_name = "afs_nlinks";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_nlinks), 0);
data_name = "afs_lockctl";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_lockctl), 0);
data_name = "afs_xflock";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_xflock), 0);
data_name = "PGetCPrefs";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_PGetCPrefs), 0);
data_name = "PSetCPrefs";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_PSetCPrefs), 0);
#ifdef AFS_HPUX_ENV
data_name = "afs_pagein";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_pagein), 0);
data_name = "afs_pageout";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_pageout), 0);
data_name = "afs_hp_strategy";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_afs_hp_strategy), 0);
#endif
data_name = "PFlushMount";
hv_store(DATA, data_name, strlen(data_name),
newSViv(cmp->callInfo.C_PFlushMount), 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_PrintUpDownStats(struct afs_stats_SrvUpDownInfo *a_upDownP, AV *UPDOWN, int index)
{
HV *INFO = newHV();
AV *DOWNDURATIONS = newAV();
AV *DOWNINCIDENTS = newAV();
int i;
/*
* First, print the simple values.
*/
hv_store(INFO, "numTtlRecords", strlen("numTtlRecords"),
newSViv(a_upDownP->numTtlRecords), 0);
hv_store(INFO, "numUpRecords", strlen("numUpRecords"),
newSViv(a_upDownP->numUpRecords), 0);
hv_store(INFO, "numDownRecords", strlen("numDownRecords"),
newSViv(a_upDownP->numDownRecords), 0);
hv_store(INFO, "sumOfRecordAges", strlen("sumOfRecordAges"),
newSViv(a_upDownP->sumOfRecordAges), 0);
hv_store(INFO, "ageOfYoungestRecord", strlen("ageOfYoungestRecord"),
newSViv(a_upDownP->ageOfYoungestRecord), 0);
hv_store(INFO, "ageOfOldestRecord", strlen("ageOfOldestRecord"),
newSViv(a_upDownP->ageOfOldestRecord), 0);
hv_store(INFO, "numDowntimeIncidents", strlen("numDowntimeIncidents"),
newSViv(a_upDownP->numDowntimeIncidents), 0);
hv_store(INFO, "numRecordsNeverDown", strlen("numRecordsNeverDown"),
newSViv(a_upDownP->numRecordsNeverDown), 0);
hv_store(INFO, "maxDowntimesInARecord", strlen("maxDowntimesInARecord"),
newSViv(a_upDownP->maxDowntimesInARecord), 0);
hv_store(INFO, "sumOfDowntimes", strlen("sumOfDowntimes"),
newSViv(a_upDownP->sumOfDowntimes), 0);
hv_store(INFO, "shortestDowntime", strlen("shortestDowntime"),
newSViv(a_upDownP->shortestDowntime), 0);
hv_store(INFO, "longestDowntime", strlen("longestDowntime"),
newSViv(a_upDownP->longestDowntime), 0);
/*
* Now, print the array values.
*/
for (i = 0; i <= 6; i++) {
av_store(DOWNDURATIONS, i, newSViv(a_upDownP->downDurations[i]));
}
for (i = 0; i <= 5; i++) {
av_store(DOWNINCIDENTS, i, newSViv(a_upDownP->downIncidents[i]));
}
hv_store(INFO, "downDurations", 13, newRV_inc((SV *) DOWNDURATIONS), 0);
hv_store(INFO, "downIncidents", 13, newRV_inc((SV *) DOWNINCIDENTS), 0);
av_store(UPDOWN, index, newRV_inc((SV *) INFO));
}
/*
* 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_PrintOverallPerfInfo(struct afs_stats_CMPerf *a_ovP, HV *PERF)
{
char *data_name;
AV *FS_UPDOWN = newAV();
AV *VL_UPDOWN = newAV();
data_name = "numPerfCalls";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->numPerfCalls),
0);
data_name = "epoch";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->epoch), 0);
data_name = "numCellsVisible";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->numCellsVisible), 0);
data_name = "numCellsContacted";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->numCellsContacted), 0);
data_name = "dlocalAccesses";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->dlocalAccesses), 0);
data_name = "vlocalAccesses";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->vlocalAccesses), 0);
data_name = "dremoteAccesses";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->dremoteAccesses), 0);
data_name = "vremoteAccesses";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->vremoteAccesses), 0);
data_name = "cacheNumEntries";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheNumEntries), 0);
data_name = "cacheBlocksTotal";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheBlocksTotal), 0);
data_name = "cacheBlocksInUse";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheBlocksInUse), 0);
data_name = "cacheBlocksOrig";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheBlocksOrig), 0);
data_name = "cacheMaxDirtyChunks";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheMaxDirtyChunks), 0);
data_name = "cacheCurrDirtyChunks";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->cacheCurrDirtyChunks), 0);
data_name = "dcacheHits";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->dcacheHits),
0);
data_name = "vcacheHits";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->vcacheHits),
0);
data_name = "dcacheMisses";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->dcacheMisses),
0);
src/Monitor.xs view on Meta::CPAN
data_name = "LargeBlocksActive";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->LargeBlocksActive), 0);
data_name = "LargeBlocksAlloced";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->LargeBlocksAlloced), 0);
data_name = "SmallBlocksActive";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->SmallBlocksActive), 0);
data_name = "SmallBlocksAlloced";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->SmallBlocksAlloced), 0);
data_name = "OutStandingMemUsage";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->OutStandingMemUsage), 0);
data_name = "OutStandingAllocs";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->OutStandingAllocs), 0);
data_name = "CallBackAlloced";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->CallBackAlloced), 0);
data_name = "CallBackFlushes";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->CallBackFlushes), 0);
data_name = "CallBackLoops";
hv_store(PERF, "cbloops", strlen("cbloops"), newSViv(a_ovP->cbloops), 0);
data_name = "srvRecords";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->srvRecords),
0);
data_name = "srvNumBuckets";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->srvNumBuckets),
0);
data_name = "srvMaxChainLength";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->srvMaxChainLength), 0);
data_name = "srvMaxChainLengthHWM";
hv_store(PERF, data_name, strlen(data_name),
newSViv(a_ovP->srvMaxChainLengthHWM), 0);
data_name = "srvRecordsHWM";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->srvRecordsHWM),
0);
data_name = "sysName_ID";
hv_store(PERF, data_name, strlen(data_name), newSViv(a_ovP->sysName_ID),
0);
my_cm_PrintUpDownStats(&(a_ovP->fs_UpDown[0]), FS_UPDOWN, 0);
my_cm_PrintUpDownStats(&(a_ovP->fs_UpDown[1]), FS_UPDOWN, 1);
my_cm_PrintUpDownStats(&(a_ovP->vl_UpDown[0]), VL_UPDOWN, 0);
my_cm_PrintUpDownStats(&(a_ovP->vl_UpDown[1]), VL_UPDOWN, 1);
hv_store(PERF, "fs_UpDown", 9, newRV_inc((SV *) FS_UPDOWN), 0);
hv_store(PERF, "vl_UpDown", 9, newRV_inc((SV *) VL_UPDOWN), 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_PrintOpTiming(a_opIdx, a_opNames, a_opTimeP, RPCTIMES)
int a_opIdx;
char *a_opNames[];
struct afs_stats_opTimingData *a_opTimeP;
HV *RPCTIMES;
{
HV *TIMES = newHV();
hv_store(TIMES, "numOps", 6, newSViv(a_opTimeP->numOps), 0);
hv_store(TIMES, "numSuccesses", 12, newSViv(a_opTimeP->numSuccesses), 0);
hv_store(TIMES, "sumTime", 7, newSVnv(a_opTimeP->sumTime.tv_sec
+
(a_opTimeP->sumTime.tv_usec /
1000000.0)), 0);
hv_store(TIMES, "sqrTime", 7,
newSVnv(a_opTimeP->sqrTime.tv_sec +
(a_opTimeP->sqrTime.tv_usec / 1000000.0)), 0);
hv_store(TIMES, "minTime", 7,
newSVnv(a_opTimeP->minTime.tv_sec +
(a_opTimeP->minTime.tv_usec / 1000000.0)), 0);
hv_store(TIMES, "maxTime", 7,
newSVnv(a_opTimeP->maxTime.tv_sec +
(a_opTimeP->maxTime.tv_usec / 1000000.0)), 0);
hv_store(RPCTIMES, 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_cm_PrintErrInfo(a_opIdx, a_opNames, a_opErrP, RPCERRORS)
int a_opIdx;
char *a_opNames[];
struct afs_stats_RPCErrors *a_opErrP;
HV *RPCERRORS;
{
HV *ERRORS = newHV();
hv_store(ERRORS, "err_Server", 10, newSViv(a_opErrP->err_Server), 0);
hv_store(ERRORS, "err_Network", 11, newSViv(a_opErrP->err_Network), 0);
hv_store(ERRORS, "err_Protection", 14, newSViv(a_opErrP->err_Protection), 0);
hv_store(ERRORS, "err_Volume", 10, newSViv(a_opErrP->err_Volume), 0);
hv_store(ERRORS, "err_VolumeBusies", 16, newSViv(a_opErrP->err_VolumeBusies), 0);
hv_store(ERRORS, "err_Other", 9, newSViv(a_opErrP->err_Other), 0);
hv_store(RPCERRORS, a_opNames[a_opIdx], strlen(a_opNames[a_opIdx]),
newRV_inc((SV *) ERRORS), 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_PrintXferTiming(a_opIdx, a_opNames, a_xferP, XFERTIMES)
int a_opIdx;
char *a_opNames[];
struct afs_stats_xferData *a_xferP;
HV *XFERTIMES;
{
HV *TIMES = newHV();
AV *COUNT = newAV();
int i;
hv_store(TIMES, "numXfers", 8, newSViv(a_xferP->numXfers), 0);
hv_store(TIMES, "numSuccesses", 12, newSViv(a_xferP->numSuccesses), 0);
hv_store(TIMES, "sumTime", 7, newSVnv(a_xferP->sumTime.tv_sec
+
(a_xferP->sumTime.tv_usec /
1000000.0)), 0);
hv_store(TIMES, "sqrTime", 7, newSVnv(a_xferP->sqrTime.tv_sec +
(a_xferP->sqrTime.tv_usec / 1000000.0)), 0);
hv_store(TIMES, "minTime", 7, newSVnv(a_xferP->minTime.tv_sec +
(a_xferP->minTime.tv_usec / 1000000.0)), 0);
hv_store(TIMES, "maxTime", 7, newSVnv(a_xferP->maxTime.tv_sec +
(a_xferP->maxTime.tv_usec / 1000000.0)), 0);
hv_store(TIMES, "sumBytes", 8, newSViv(a_xferP->sumBytes), 0);
hv_store(TIMES, "minBytes", 8, newSViv(a_xferP->minBytes), 0);
hv_store(TIMES, "maxBytes", 8, newSViv(a_xferP->maxBytes), 0);
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;
int index;
char *buffer;
va_list argp;
{
AV *RETVAL = va_arg(argp, AV *);
HV *HOSTINFO = newHV();
hv_store(HOSTINFO, "probeOK", 7, newSViv(xstat_cm_Results.probeOK ? 0 : 1),
0);
hv_store(HOSTINFO, "hostName", 8,
newSVpv(xstat_cm_Results.connP->hostName, 0), 0);
hv_store(HOSTINFO, "collectionNumber", 16,
newSViv(xstat_cm_Results.collectionNumber), 0);
hv_store(HOSTINFO, "probeTime", 9, newSViv(xstat_cm_Results.probeTime), 0);
if (xstat_cm_Results.probeOK == 0) {
switch (xstat_cm_Results.collectionNumber) {
/* Why are so many things commented out? -EC */
case AFSCB_XSTATSCOLL_CALL_INFO:
/* Why was this commented out in 3.3 ? */
/* PrintCallInfo(); */
my_print_cmCallStats(&xstat_cm_Results, HOSTINFO);
break;
case AFSCB_XSTATSCOLL_PERF_INFO:
/* we will do nothing here */
/* PrintPerfInfo(); */
my_cm_PrintPerfInfo(&xstat_cm_Results, HOSTINFO);
break;
case AFSCB_XSTATSCOLL_FULL_PERF_INFO:
my_cm_PrintFullPerfInfo(&xstat_cm_Results, HOSTINFO);
break;
default:
sprintf(buffer, "** Unknown collection: %d",
xstat_cm_Results.collectionNumber);
return (-1);
}
}
av_store(RETVAL, index, newRV_inc((SV *) HOSTINFO));
return (0);
}
/* end of xstat_cm_test helper functions */
MODULE = AFS::Monitor PACKAGE = AFS::Monitor PREFIX = afs_
PROTOTYPES: ENABLE
BOOT:
initialize_rxk_error_table();
void
afs_do_xstat_cm_test(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
AV *host_array=0;
AV *coll_array=0;
int code; /*Return code*/
int numCMs=0; /*# Cache Managers to monitor*/
int numCollIDs=0; /*# collections to fetch*/
int currCM; /*Loop index*/
int currCollIDIdx; /*Index of current collection ID*/
afs_int32 *collIDP; /*Ptr to array of collection IDs*/
afs_int32 *currCollIDP; /*Ptr to current collection ID*/
struct sockaddr_in *CMSktArray; /*Cache Manager socket array */
struct hostent *he; /*Host entry*/
AV *RETVAL = newAV();
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
if(strncmp(key, "collID", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
coll_array = (AV*) SvRV(value);
else {
coll_array = av_make(1, &value);
sv_2mortal((SV *) coll_array);
}
numCollIDs = av_len(coll_array) + 1;
}
else if(strncmp(key, "cmname", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
host_array = (AV*) SvRV(value);
else {
host_array = av_make(1, &value);
sv_2mortal((SV *) host_array);
}
numCMs = av_len(host_array) + 1;
}
else {
sprintf(buffer, "Unrecognized flag: %s", key);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
} /* end ifs */
} /* end while */
/* done parsing arguments */
if (host_array == 0) {
sprintf(buffer, "Missing required parameter 'cmname'");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
src/Monitor.xs view on Meta::CPAN
else if (coll_array == 0) {
sprintf(buffer, "Missing required parameter 'collID'");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
else if (numCollIDs == 0) {
sprintf(buffer, "The field 'collID' isn't completed properly");
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
CMSktArray = (struct sockaddr_in *)
malloc(numCMs * sizeof(struct sockaddr_in));
if (CMSktArray == (struct sockaddr_in *) NULL) {
sprintf(buffer, "Can't allocate socket array for %d Cache Managers",
numCMs);
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
for (currCM = 0; currCM < numCMs; currCM++) {
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
CMSktArray[currCM].sin_family = AF_INET; /*Internet family */
#else
CMSktArray[currCM].sin_family = htons(AF_INET); /*Internet family */
#endif
CMSktArray[currCM].sin_port = htons(7001); /*Cache Manager port */
he = hostutil_GetHostByName((char *) SvPV(*av_fetch(host_array, currCM, 0), PL_na));
if (he == (struct hostent *) NULL) {
sprintf(buffer,
"Can't get host info for '%s'\n",
(char *) SvPV(*av_fetch(host_array, currCM, 0), PL_na));
BSETCODE(-1, buffer);
XSRETURN_UNDEF;
}
memcpy(&(CMSktArray[currCM].sin_addr.s_addr), he->h_addr, 4);
} /*Get socket info for each Cache Manager*/
collIDP = (afs_int32 *) malloc(numCollIDs * sizeof(afs_int32));
currCollIDP = collIDP;
for (currCollIDIdx = 0; currCollIDIdx < numCollIDs; currCollIDIdx++) {
*currCollIDP = (afs_int32) SvIV(*av_fetch(coll_array, currCollIDIdx, 0));
currCollIDP++;
}
code = my_xstat_cm_Init(my_xstat_CM_Handler, numCMs, CMSktArray,
numCollIDs, collIDP, buffer, RETVAL);
if(code) {
BSETCODE(code, buffer);
XSRETURN_UNDEF;
}
ST(0) = sv_2mortal(newRV_inc((SV*)RETVAL));
SETCODE(0);
XSRETURN(1);
}
void
afs_do_xstat_fs_test(args)
HV* args = (HV*) SvRV($arg);
PREINIT:
PPCODE:
{
SV *value;
I32 keylen = 0;
char *key;
int num_args = 0;
char buffer[256] = "";
AV *host_array=0;
AV *coll_array=0;
int code; /*Return code*/
int numFSs=0; /*# File Servers to monitor*/
int numCollIDs=0; /*# collections to fetch*/
int currFS; /*Loop index*/
int currCollIDIdx; /*Index of current collection ID*/
afs_int32 *collIDP; /*Ptr to array of collection IDs*/
afs_int32 *currCollIDP; /*Ptr to current collection ID*/
struct sockaddr_in *FSSktArray; /*File Server socket array */
int sktbytes;
struct hostent *he; /*Host entry*/
AV *RETVAL = newAV();
/* parse arguments */
num_args = hv_iterinit(args);
while (num_args--) {
value = hv_iternextsv(args, &key, &keylen);
switch (*key) {
case 'c':
if(strncmp(key, "collID", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
coll_array = (AV*) SvRV(value);
else {
coll_array = av_make(1, &value);
sv_2mortal((SV *) coll_array);
}
numCollIDs = av_len(coll_array) + 1;
} else goto unrecognized;
break;
case 'f':
if(strncmp(key, "fsname", keylen) == 0 && keylen <= 6) {
if (SvROK(value))
host_array = (AV*) SvRV(value);
else {
host_array = av_make(1, &value);
sv_2mortal((SV *) host_array);
}
numFSs = av_len(host_array) + 1;
} else goto unrecognized;
break;
default:
unrecognized:
sprintf(buffer, "Unrecognized flag: %s", key);
( run in 1.374 second using v1.01-cache-2.11-cpan-9581c071862 )