Exemplo n.º 1
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_CMCellName_t cellName;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_CMLocalCell(conn, cellName, &st);
    if (!rc) {
	fprintf(stderr, "util_CMLocalCell, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    printf("\n");
    printf("Client %s (port %ld) is in cell %s\n", srvrName, srvrPort,
	   cellName);
    printf("\n");

    exit(0);
}
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    rxdebugHandle_p handle;
    char *srvrName;
    long srvrPort;
    afs_uint32 supported;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
        fprintf(stderr, "afsclient_Init, status %d\n", st);
        exit(1);
    }

    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
    if (!rc) {
        fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
        exit(1);
    }

    rc = util_RXDebugSupportedStats(handle, &supported, &st);
    if (!rc) {
        fprintf(stderr, "util_RXDebugSupportedStats, status %d\n", st);
        exit(1);
    }

    rc = afsclient_RXDebugClose(handle, &st);
    if (!rc) {
        fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
        exit(1);
    }

    printf("\n");
    printf("security stats: %s supported\n",
           (supported & RX_SERVER_DEBUG_SEC_STATS) ? "" : " not");
    printf("all connections:%s supported\n",
           (supported & RX_SERVER_DEBUG_ALL_CONN) ? "" : " not");
    printf("rx stats:       %s supported\n",
           (supported & RX_SERVER_DEBUG_RX_STATS) ? "" : " not");
    printf("waiter count:   %s supported\n",
           (supported & RX_SERVER_DEBUG_WAITER_CNT) ? "" : " not");
    printf("idle threads:   %s supported\n",
           (supported & RX_SERVER_DEBUG_IDLE_THREADS) ? "" : " not");
    printf("all peers:      %s supported\n",
           (supported & RX_SERVER_DEBUG_ALL_PEER) ? "" : " not");
    printf("\n");

    exit(0);
}
Exemplo n.º 3
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    rxdebugHandle_p handle;
    char *srvrName;
    long srvrPort;
    rxdebugVersion_t version;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RXDebugVersion(handle, version, &st);
    if (!rc) {
	fprintf(stderr, "util_RXDebugVersion, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugClose(handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
	exit(1);
    }

    printf("\n");
    printf("AFS Version: '%s'\n", version);
    printf("\n");

    exit(0);
}
Exemplo n.º 4
0
int
main(int argc, char **argv)
{
    int i;
    afs_status_t status;

#ifdef	AFS_AIX32_ENV
    /*
     * The following signal action for AIX is necessary so that in case of a 
     * crash (i.e. core is generated) we can include the user's data section 
     * in the core dump. Unfortunately, by default, only a partial core is
     * generated which, in many cases, isn't too useful.
     */
    struct sigaction nsa;

    sigemptyset(&nsa.sa_mask);
    nsa.sa_handler = SIG_DFL;
    nsa.sa_flags = SA_FULLDUMP;
    sigaction(SIGSEGV, &nsa, NULL);
#endif

    if (argc < 2) {
	fprintf(stderr, "Usage is: %s [<code>]+\n", argv[0]);
	exit(1);
    }

    if (!afsclient_Init(&status)) {
	fprintf(stderr, "Unable to initialize error tables\n");
	exit(1);
    }

    for (i = 1; i < argc; i++) {
	const char *errText;
	afs_status_t errStatus;

	status = (afs_status_t) atoi(argv[i]);
	util_AdminErrorCodeTranslate(status, 0, &errText, &errStatus);
	printf("%d = %s\n", status, errText);
    }
    return 0;
}
Exemplo n.º 5
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    char *cellName;
    void *tokenHandle;
    void *cellHandle;

    ParseArgs(argc, argv, &cellName, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_TokenGetExisting(cellName, &tokenHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_TokenGetExisting, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellOpen(cellName, tokenHandle, &cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatOpenPort(cellHandle, srvrName, srvrPort, &conn,
				   &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RPCStatsStateEnable(conn, RXSTATS_EnablePeerRPCStats, &st);
    if (!rc) {
	fprintf(stderr, "util_RPCStatsStateEnable, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_TokenClose(tokenHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_TokenClose, status %d\n", st);
	exit(1);
    }

    exit(0);
}
Exemplo n.º 6
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_RPCStatsState_t state;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatOpenPort(cellHandle, srvrName, srvrPort, &conn,
				   &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RPCStatsStateGet(conn, RXSTATS_QueryPeerRPCStats, &state, &st);
    if (!rc) {
	fprintf(stderr, "util_RPCStatsStateGet, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    printf("\n");
    printf("Peer RPC stats are ");
    switch (state) {
    case AFS_RPC_STATS_DISABLED:
	printf("disabled\n");
	break;
    case AFS_RPC_STATS_ENABLED:
	printf("enabled\n");
	break;
    default:
	printf("INVALID\n");
	break;
    }
    printf("\n");

    exit(0);
}
Exemplo n.º 7
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_ClientConfig_t config;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_CMClientConfig(conn, &config, &st);
    if (!rc) {
	fprintf(stderr, "util_CMClientConfig, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }


    printf("\nClient configuration for %s (port %ld):\n\n", srvrName,
	   srvrPort);
    printf("    clientVersion:  %d\n", config.clientVersion);
    printf("    serverVersion:  %d\n", config.serverVersion);
    printf("    nChunkFiles:    %d\n", config.c.config_v1.nChunkFiles);
    printf("    nStatCaches:    %d\n", config.c.config_v1.nStatCaches);
    printf("    nDataCaches:    %d\n", config.c.config_v1.nDataCaches);
    printf("    nVolumeCaches:  %d\n", config.c.config_v1.nVolumeCaches);
    printf("    firstChunkSize: %d\n", config.c.config_v1.firstChunkSize);
    printf("    otherChunkSize: %d\n", config.c.config_v1.otherChunkSize);
    printf("    cacheSize:      %d\n", config.c.config_v1.cacheSize);
    printf("    setTime:        %d\n", config.c.config_v1.setTime);
    printf("    memCache:       %d\n", config.c.config_v1.memCache);
    printf("\n");

    exit(0);
}
Exemplo n.º 8
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_CMListCell_t cellInfo;
    void *iterator;
    afs_uint32 taddr;
    int i;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_CMListCellsBegin(conn, &iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_CMListCellsBegin, status %d\n", st);
	exit(1);
    }

    printf("\n");
    while (util_CMListCellsNext(iterator, &cellInfo, &st)) {
	printf("Cell %s on hosts", cellInfo.cellname);
	for (i = 0; i < UTIL_MAX_CELL_HOSTS && cellInfo.serverAddr[i]; i++) {
	    taddr = cellInfo.serverAddr[i];
	    printf(" %d.%d.%d.%d", (taddr >> 24) & 0xff, (taddr >> 16) & 0xff,
		   (taddr >> 8) & 0xff, taddr & 0xff);
	}
	printf("\n");
    }
    if (st != ADMITERATORDONE) {
	fprintf(stderr, "util_CMListCellsNext, status %d\n", st);
	exit(1);
    }
    printf("\n");

    rc = util_CMListCellsDone(iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_CMListCellsDone, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    exit(0);
}
Exemplo n.º 9
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    rxdebugHandle_p handle;
    char *srvrName;
    long srvrPort;
    void *iterator;
    struct rx_debugPeer peer;
    afs_uint32 supportedValues;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RXDebugPeersBegin(handle, &iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_RXDebugPeersBegin, status %d\n", st);
	exit(1);
    }

    while (util_RXDebugPeersNext(iterator, &peer, &supportedValues, &st)) {
	printf("\n");
	printf("host:            %u.%u.%u.%u\n", (peer.host >> 24) & 0xff,
	       (peer.host >> 16) & 0xff, (peer.host >> 8) & 0xff,
	       peer.host & 0xff);
	printf("port:            %u\n", peer.port);
	printf("ifMTU:           %u\n", peer.ifMTU);
	printf("idleWhen:        %u\n", peer.idleWhen);
	printf("refCount:        %u\n", peer.refCount);
	printf("burstSize:       %u\n", peer.burstSize);
	printf("burst:           %u\n", peer.burst);
	printf("burstWait:       %u.%06u\n", peer.burstWait.sec,
	       peer.burstWait.usec);
	printf("rtt:             %u\n", peer.rtt);
	printf("rtt_dev:         %u\n", peer.rtt_dev);
	printf("timeout:         %u.%06u\n", peer.timeout.sec,
	       peer.timeout.usec);
	printf("nSent:           %u\n", peer.nSent);
	printf("reSends:         %u\n", peer.reSends);
	printf("inPacketSkew:    %u\n", peer.inPacketSkew);
	printf("outPacketSkew:   %u\n", peer.outPacketSkew);
	printf("rateFlag:        %u\n", peer.rateFlag);
	printf("natMTU:          %u\n", peer.natMTU);
	printf("maxMTU:          %u\n", peer.maxMTU);
	printf("maxDgramPackets: %u\n", peer.maxDgramPackets);
	printf("ifDgramPackets:  %u\n", peer.ifDgramPackets);
	printf("MTU:             %u\n", peer.MTU);
	printf("cwind:           %u\n", peer.cwind);
	printf("nDgramPackets:   %u\n", peer.nDgramPackets);
	printf("congestSeq:      %u\n", peer.congestSeq);
	printf("bytesSent:       (%u.%u)\n", hgethi(peer.bytesSent),
	       hgetlo(peer.bytesSent));
	printf("bytesReceived:   (%u.%u)\n", hgethi(peer.bytesReceived),
	       hgetlo(peer.bytesReceived));
    }
    if (st != ADMITERATORDONE) {
	fprintf(stderr, "util_RXDebugPeersNext, status %d\n", st);
	exit(1);
    }
    printf("\n");

    rc = util_RXDebugPeersDone(iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_RXDebugPeersDone, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugClose(handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
	exit(1);
    }

    exit(0);
}
Exemplo n.º 10
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_CMServerPref_t prefs;
    void *iterator;
    afs_uint32 taddr;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_CMGetServerPrefsBegin(conn, &iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_CMGetServerPrefsBegin, status %d\n", st);
	exit(1);
    }

    printf("\n");
    while (util_CMGetServerPrefsNext(iterator, &prefs, &st)) {
	taddr = prefs.ipAddr;
	printf("%d.%d.%d.%d\t\t\t%d\n", (taddr >> 24) & 0xff,
	       (taddr >> 16) & 0xff, (taddr >> 8) & 0xff, taddr & 0xff,
	       prefs.ipRank);
    }
    if (st != ADMITERATORDONE) {
	fprintf(stderr, "util_CMGetServerPrefsNext, status %d\n", st);
	exit(1);
    }
    printf("\n");

    rc = util_CMGetServerPrefsDone(iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_CMGetServerPrefsDone, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    exit(0);
}
Exemplo n.º 11
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    rxdebugHandle_p handle;
    char *srvrName;
    long srvrPort;
    struct rx_statistics stats;
    afs_uint32 supportedStats;
    char tstr[32];
    int i;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RXDebugRxStats(handle, &stats, &supportedStats, &st);
    if (!rc) {
	fprintf(stderr, "util_RXDebugBasicStats, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RXDebugClose(handle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
	exit(1);
    }

    printf("\n");
    printf("RX stats: host %s (port %ld)\n", srvrName, srvrPort);
    printf("\n");
    printf("    packetRequests:              %d\n", stats.packetRequests);
    printf("    receivePktAllocFailures:     %d\n",
	   stats.receivePktAllocFailures);
    if (supportedStats & RX_SERVER_DEBUG_NEW_PACKETS) {
	printf("    receiveCbufPktAllocFailures: %d\n",
	       stats.receiveCbufPktAllocFailures);
    }
    printf("    sendPktAllocFailures:        %d\n",
	   stats.sendPktAllocFailures);
    if (supportedStats & RX_SERVER_DEBUG_NEW_PACKETS) {
	printf("    sendCbufPktAllocFailures:    %d\n",
	       stats.sendCbufPktAllocFailures);
    }
    printf("    specialPktAllocFailures:     %d\n",
	   stats.specialPktAllocFailures);
    printf("    socketGreedy:                %d\n", stats.socketGreedy);
    printf("    bogusPacketOnRead:           %d\n", stats.bogusPacketOnRead);
    printf("    bogusHost:                   %d\n", stats.bogusHost);
    printf("    noPacketOnRead:              %d\n", stats.noPacketOnRead);
    printf("    noPacketBuffersOnRead:       %d\n",
	   stats.noPacketBuffersOnRead);
    printf("    selects:                     %d\n", stats.selects);
    printf("    sendSelects:                 %d\n", stats.sendSelects);
    printf("    packetsRead:\n");
    for (i = 0; i < RX_N_PACKET_TYPES; i++) {
	strcpy(tstr, packetTypes[i]);
	printf("\t%-24s %d\n", strcat(tstr, ":"), stats.packetsRead[i]);
    }
    printf("    dataPacketsRead:             %d\n", stats.dataPacketsRead);
    printf("    ackPacketsRead:              %d\n", stats.ackPacketsRead);
    printf("    dupPacketsRead:              %d\n", stats.dupPacketsRead);
    printf("    spuriousPacketsRead:         %d\n",
	   stats.spuriousPacketsRead);
    printf("    ignorePacketDally:           %d\n", stats.ignorePacketDally);
    printf("    packetsSent:\n");
    for (i = 0; i < RX_N_PACKET_TYPES; i++) {
	strcpy(tstr, packetTypes[i]);
	printf("\t%-24s %d\n", strcat(tstr, ":"), stats.packetsSent[i]);
    }
    printf("    ackPacketsSent:              %d\n", stats.ackPacketsSent);
    printf("    dataPacketsSent:             %d\n", stats.dataPacketsSent);
    printf("    dataPacketsReSent:           %d\n", stats.dataPacketsReSent);
    printf("    dataPacketsPushed:           %d\n", stats.dataPacketsPushed);
    printf("    ignoreAckedPacket:           %d\n", stats.ignoreAckedPacket);
    printf("    netSendFailures:             %d\n", stats.netSendFailures);
    printf("    fatalErrors:                 %d\n", stats.fatalErrors);
    printf("    nRttSamples:                 %d\n", stats.nRttSamples);
    printf("    totalRtt:                    %.6f\n",
	   clock_Float(&stats.totalRtt));
    printf("    minRtt:                      %.6f\n",
	   clock_Float(&stats.minRtt));
    printf("    maxRtt:                      %.6f\n",
	   clock_Float(&stats.maxRtt));
    printf("    nServerConns:                %d\n", stats.nServerConns);
    printf("    nClientConns:                %d\n", stats.nClientConns);
    printf("    nPeerStructs:                %d\n", stats.nPeerStructs);
    printf("    nCallStructs:                %d\n", stats.nCallStructs);
    printf("    nFreeCallStructs:            %d\n", stats.nFreeCallStructs);
    printf("\n");

    exit(0);
}
Exemplo n.º 12
0
int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    void *iterator;
    afs_RPCStats_t stats;
    char ifName[128];
    char role[8];
    const char **funcList;
    int funcListLen;
    int index;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatOpenPort(cellHandle, srvrName, srvrPort, &conn,
				   &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_RPCStatsGetBegin(conn, RXSTATS_RetrieveProcessRPCStats,
			       &iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_RPCStatsGetBegin, status %d\n", st);
	exit(1);
    }

    while (util_RPCStatsGetNext(iterator, &stats, &st)) {
	index = stats.s.stats_v1.func_index;

	if (index == 0) {
	    GetPrintStrings(&stats, ifName, role, &funcList, &funcListLen);
	    printf("\nProcess RPC stats for %s accessed as a %s\n\n", ifName,
		   role);
	}

	if (index >= funcListLen) {
	    printf("    Function index %d\n", index);
	} else {
	    printf("    %s\n", funcList[index]);
	}

	if (stats.s.stats_v1.invocations != 0) {
	    printf("\tinvoc %"AFS_UINT64_FMT
		   " bytes_sent %"AFS_UINT64_FMT
		   " bytes_rcvd %"AFS_UINT64_FMT"\n",
		   stats.s.stats_v1.invocations,
		   stats.s.stats_v1.bytes_sent,
		   stats.s.stats_v1.bytes_rcvd);
	    printf("\tqsum %d.%06d qsqr %d.%06d"
		   " qmin %d.%06d qmax %d.%06d\n",
		   stats.s.stats_v1.queue_time_sum.sec,
		   stats.s.stats_v1.queue_time_sum.usec,
		   stats.s.stats_v1.queue_time_sum_sqr.sec,
		   stats.s.stats_v1.queue_time_sum_sqr.usec,
		   stats.s.stats_v1.queue_time_min.sec,
		   stats.s.stats_v1.queue_time_min.usec,
		   stats.s.stats_v1.queue_time_max.sec,
		   stats.s.stats_v1.queue_time_max.usec);
	    printf("\txsum %d.%06d xsqr %d.%06d"
		   " xmin %d.%06d xmax %d.%06d\n",
		   stats.s.stats_v1.execution_time_sum.sec,
		   stats.s.stats_v1.execution_time_sum.usec,
		   stats.s.stats_v1.execution_time_sum_sqr.sec,
		   stats.s.stats_v1.execution_time_sum_sqr.usec,
		   stats.s.stats_v1.execution_time_min.sec,
		   stats.s.stats_v1.execution_time_min.usec,
		   stats.s.stats_v1.execution_time_max.sec,
		   stats.s.stats_v1.execution_time_max.usec);
	} else {
	    printf("\tNever invoked\n");
	}
    }
    if (st != ADMITERATORDONE) {
	fprintf(stderr, "util_RPCStatsGetNext, status %d\n", st);
	exit(1);
    }
    printf("\n");

    rc = util_RPCStatsGetDone(iterator, &st);
    if (!rc) {
	fprintf(stderr, "util_RPCStatsGetDone, status %d\n", st);
	exit(1);
    }

    rc = afsclient_RPCStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_RPCStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    exit(0);
}