2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
9 * Portions Copyright (c) 2003 Apple Computer, Inc.
13 * This file contains sample code for the rxstats interface
16 #include <afsconfig.h>
17 #include <afs/param.h>
26 #include <rx/rxstat.h>
28 #include <afs/afs_Admin.h>
29 #include <afs/afs_clientAdmin.h>
30 #include <afs/afs_utilAdmin.h>
35 fprintf(stderr
, "Usage: rxdebug_basic_stats <host> <port>\n");
40 ParseArgs(int argc
, char *argv
[], char **srvrName
, long *srvrPort
)
46 *srvrName
= *(argp
++);
49 *srvrPort
= strtol(*(argp
++), NULL
, 0);
50 if (*srvrPort
<= 0 || *srvrPort
>= 65536)
57 main(int argc
, char *argv
[])
61 rxdebugHandle_p handle
;
64 struct rx_debugStats stats
;
66 ParseArgs(argc
, argv
, &srvrName
, &srvrPort
);
68 rc
= afsclient_Init(&st
);
70 fprintf(stderr
, "afsclient_Init, status %d\n", st
);
74 rc
= afsclient_RXDebugOpenPort(srvrName
, srvrPort
, &handle
, &st
);
76 fprintf(stderr
, "afsclient_RXDebugOpenPort, status %d\n", st
);
80 rc
= util_RXDebugBasicStats(handle
, &stats
, &st
);
82 fprintf(stderr
, "util_RXDebugBasicStats, status %d\n", st
);
86 rc
= afsclient_RXDebugClose(handle
, &st
);
88 fprintf(stderr
, "afsclient_RXDebugClose, status %d\n", st
);
93 printf("nFreePackets: %d\n", stats
.nFreePackets
);
94 printf("packetReclaims: %d\n", stats
.packetReclaims
);
95 printf("callsExecuted: %d\n", stats
.callsExecuted
);
96 printf("waitingForPackets: %d\n", stats
.waitingForPackets
);
97 printf("usedFDs: %d\n", stats
.usedFDs
);
98 printf("version: '%c'\n", stats
.version
);
99 printf("nWaiting: %d\n", stats
.nWaiting
);
100 printf("idleThreads: %d\n", stats
.idleThreads
);