Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / s_debug.c
index 33ce080058e0eed688cf9120148e47fecc88c9ff..8bf56eb07b6a67a24ae7860b7f0927bd5e1d79ba 100644 (file)
@@ -31,6 +31,7 @@
 #include "ircd_reply.h"
 #include "ircd.h"
 #include "list.h"
+#include "msgq.h"
 #include "numeric.h"
 #include "numnicks.h"
 #include "res.h"
@@ -274,6 +275,10 @@ void count_memory(struct Client *cptr, char *nick)
       com = 0,                  /* memory used by conf lines */
       dbufs_allocated = 0,      /* memory used by dbufs */
       dbufs_used = 0,           /* memory used by dbufs */
+      msg_allocated = 0,       /* memory used by struct Msg */
+      msg_used = 0,            /* memory used by struct Msg */
+      msgbuf_allocated = 0,    /* memory used by struct MsgBuf */
+      msgbuf_used = 0,         /* memory used by struct MsgBuf */
       rm = 0,                   /* res memory used */
       totcl = 0, totch = 0, totww = 0, tot = 0;
 
@@ -394,11 +399,20 @@ void count_memory(struct Client *cptr, char *nick)
             ":DBufs allocated %d(%zu) used %d(%zu)", DBufAllocCount,
             dbufs_allocated, DBufUsedCount, dbufs_used);
 
+  msgq_count_memory(&msg_allocated, &msg_used, &msgbuf_allocated,
+                   &msgbuf_used);
+  send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
+            ":Msgs allocated %d(%zu) used %d(%zu)", msgCounts.alloc,
+            msg_allocated, msgCounts.used, msg_used);
+  send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
+            ":MsgBufs allocated %d(%zu) used %d(%zu)", msgBufCounts.alloc,
+            msgbuf_allocated, msgBufCounts.used, msgbuf_used);
+
   rm = cres_mem(cptr);
 
   tot =
-      totww + totch + totcl + com + cl * sizeof(struct ConnectionClass) + dbufs_allocated +
-      rm;
+      totww + totch + totcl + com + cl * sizeof(struct ConnectionClass) +
+      dbufs_allocated + msg_allocated + msgbuf_allocated + rm;
   tot += sizeof(void *) * HASHSIZE * 3;
 
 #if !defined(NDEBUG)
@@ -407,7 +421,8 @@ void count_memory(struct Client *cptr, char *nick)
 #endif
 
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
-            ":Total: ww %zu ch %zu cl %zu co %zu db %zu", totww, totch,
-            totcl, com, dbufs_allocated);
+            ":Total: ww %zu ch %zu cl %zu co %zu db %zu ms %zu mb %zu",
+            totww, totch, totcl, com, dbufs_allocated, msg_allocated,
+            msgbuf_allocated);
 }