From 918b68629d7ea9ff9b96a15ad66fb603e4a0e894 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 25 Sep 2008 20:55:16 +0000 Subject: [PATCH] DEVEL15-rx-packet-allocation-debug-20080925 LICENSE IPL10 add field to track allocated packets (cherry picked from commit b84da5849261867b201646e957c014e933a2c17f) --- src/rx/rx.c | 11 ++++++++--- src/rx/rx.h | 7 +++++-- src/rxdebug/rxdebug.c | 13 ++++++++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 8bc0fe626..4305fde6a 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -2184,7 +2184,7 @@ rxi_NewCall(register struct rx_connection *conn, register int channel) } else { call = (struct rx_call *)rxi_Alloc(sizeof(struct rx_call)); - + rx_MutexIncrement(rx_stats.nFreeCallStructs, rx_stats_mutex); MUTEX_EXIT(&rx_freeCallQueue_lock); MUTEX_INIT(&call->lock, "call lock", MUTEX_DEFAULT, NULL); MUTEX_ENTER(&call->lock); @@ -2192,7 +2192,6 @@ rxi_NewCall(register struct rx_connection *conn, register int channel) CV_INIT(&call->cv_rq, "call rq", CV_DEFAULT, 0); CV_INIT(&call->cv_tq, "call tq", CV_DEFAULT, 0); - rx_MutexIncrement(rx_stats.nFreeCallStructs, rx_stats_mutex); /* Initialize once-only items */ queue_Init(&call->tq); queue_Init(&call->rq); @@ -6550,6 +6549,8 @@ rx_GetServerDebug(osi_socket socket, afs_uint32 remoteAddr, afs_uint32 * supportedValues) { struct rx_debugIn in; + afs_int32 *lp = (afs_int32 *) stat; + int i; afs_int32 rc = 0; *supportedValues = 0; @@ -6590,12 +6591,16 @@ rx_GetServerDebug(osi_socket socket, afs_uint32 remoteAddr, if (stat->version >= RX_DEBUGI_VERSION_W_WAITED) { *supportedValues |= RX_SERVER_DEBUG_WAITED_CNT; } - + if (stat->version >= RX_DEBUGI_VERSION_W_PACKETS) { + *supportedValues |= RX_SERVER_DEBUG_PACKETS_CNT; + } stat->nFreePackets = ntohl(stat->nFreePackets); stat->packetReclaims = ntohl(stat->packetReclaims); stat->callsExecuted = ntohl(stat->callsExecuted); stat->nWaiting = ntohl(stat->nWaiting); stat->idleThreads = ntohl(stat->idleThreads); + stat->nWaited = ntohl(stat->nWaited); + stat->nPackets = ntohl(stat->nPackets); } return rc; diff --git a/src/rx/rx.h b/src/rx/rx.h index a69383978..4d6e30464 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -845,7 +845,7 @@ struct rx_debugIn { #define RX_DEBUGI_BADTYPE (-8) #define RX_DEBUGI_VERSION_MINIMUM ('L') /* earliest real version */ -#define RX_DEBUGI_VERSION ('R') /* Latest version */ +#define RX_DEBUGI_VERSION ('S') /* Latest version */ /* first version w/ secStats */ #define RX_DEBUGI_VERSION_W_SECSTATS ('L') /* version M is first supporting GETALLCONN and RXSTATS type */ @@ -858,6 +858,7 @@ struct rx_debugIn { #define RX_DEBUGI_VERSION_W_NEWPACKETTYPES ('P') #define RX_DEBUGI_VERSION_W_GETPEER ('Q') #define RX_DEBUGI_VERSION_W_WAITED ('R') +#define RX_DEBUGI_VERSION_W_PACKETS ('S') #define RX_DEBUGI_GETSTATS 1 /* get basic rx stats */ #define RX_DEBUGI_GETCONN 2 /* get connection info */ @@ -876,7 +877,8 @@ struct rx_debugStats { afs_int32 nWaiting; afs_int32 idleThreads; /* Number of server threads that are idle */ afs_int32 nWaited; - afs_int32 spare2[7]; + afs_int32 nPackets; + afs_int32 spare2[6]; }; struct rx_debugConn_vL { @@ -1002,6 +1004,7 @@ extern int rx_callHoldType; #define RX_SERVER_DEBUG_NEW_PACKETS 0x40 #define RX_SERVER_DEBUG_ALL_PEER 0x80 #define RX_SERVER_DEBUG_WAITED_CNT 0x100 +#define RX_SERVER_DEBUG_PACKETS_CNT 0x200 #define AFS_RX_STATS_CLEAR_ALL 0xffffffff #define AFS_RX_STATS_CLEAR_INVOCATIONS 0x1 diff --git a/src/rxdebug/rxdebug.c b/src/rxdebug/rxdebug.c index cf0d1e734..e66db4ad3 100644 --- a/src/rxdebug/rxdebug.c +++ b/src/rxdebug/rxdebug.c @@ -106,6 +106,7 @@ MainCommand(struct cmd_syndesc *as, void *arock) int withIdleThreads; int withWaited; int withPeers; + int withPackets; struct rx_debugStats tstats; char *portName, *hostName; char hoststr[20]; @@ -255,10 +256,16 @@ MainCommand(struct cmd_syndesc *as, void *arock) withIdleThreads = (supportedDebugValues & RX_SERVER_DEBUG_IDLE_THREADS); withWaited = (supportedDebugValues & RX_SERVER_DEBUG_WAITED_CNT); withPeers = (supportedDebugValues & RX_SERVER_DEBUG_ALL_PEER); + withPackets = (supportedDebugValues & RX_SERVER_DEBUG_PACKETS_CNT); - printf("Free packets: %d, packet reclaims: %d, calls: %d, used FDs: %d\n", - tstats.nFreePackets, tstats.packetReclaims, tstats.callsExecuted, - tstats.usedFDs); + if (withPackets) + printf("Free packets: %d/%d, packet reclaims: %d, calls: %d, used FDs: %d\n", + tstats.nFreePackets, tstats.nPackets, tstats.packetReclaims, + tstats.callsExecuted, tstats.usedFDs); + else + printf("Free packets: %d, packet reclaims: %d, calls: %d, used FDs: %d\n", + tstats.nFreePackets, tstats.packetReclaims, tstats.callsExecuted, + tstats.usedFDs); if (!tstats.waitingForPackets) printf("not "); printf("waiting for packets.\n"); -- 2.39.5