]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-rx-packet-allocation-debug-20080925
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 25 Sep 2008 20:55:16 +0000 (20:55 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 25 Sep 2008 20:55:16 +0000 (20:55 +0000)
LICENSE IPL10

add field to track allocated packets

(cherry picked from commit b84da5849261867b201646e957c014e933a2c17f)

src/rx/rx.c
src/rx/rx.h
src/rxdebug/rxdebug.c

index 8bc0fe6260dafc32a606f52bc25803c704c347df..4305fde6aea6b514c4f3da2dea13b0e6454a43ed 100644 (file)
@@ -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;
index a69383978e67eabbe3440ac4ea01ce0d6764a6f3..4d6e30464a245098dec8bedb23813667736ed030 100644 (file)
@@ -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
index cf0d1e7341bb0fa0fdf57f7ec291d896882117ff..e66db4ad3d4f39cb3db51bab64eb7535540d8a19 100644 (file)
@@ -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");