Revision: 14265
Author: adrian.chadd
Date: Sun Aug  9 21:22:14 2009
Log: Hack back in the squidaio_stats page.


http://code.google.com/p/lusca-cache/source/detail?r=14265

Modified:
  /branches/LUSCA_HEAD/libasyncio/aiops.c
  /branches/LUSCA_HEAD/libasyncio/aiops.h
  /branches/LUSCA_HEAD/libasyncio/async_io.c
  /branches/LUSCA_HEAD/libasyncio/async_io.h
  /branches/LUSCA_HEAD/src/stat.c

=======================================
--- /branches/LUSCA_HEAD/libasyncio/aiops.c     Wed Jul 22 07:37:20 2009
+++ /branches/LUSCA_HEAD/libasyncio/aiops.c     Sun Aug  9 21:22:14 2009
@@ -877,3 +877,13 @@
        break;
      }
  }
+
+/*
+ * This is purely to get the thread list for stats in src/stat.c .
+ * Please don't use it for anything else.
+ */
+squidaio_thread_t *
+squidaio_get_thread_head(void)
+{
+       return threads;
+}
=======================================
--- /branches/LUSCA_HEAD/libasyncio/aiops.h     Fri May  1 01:36:14 2009
+++ /branches/LUSCA_HEAD/libasyncio/aiops.h     Sun Aug  9 21:22:14 2009
@@ -85,5 +85,7 @@
  int squidaio_operations_pending(void);
  int squidaio_sync(void);
  int squidaio_get_queue_len(void);
+squidaio_thread_t * squidaio_get_thread_head(void);
+

  #endif
=======================================
--- /branches/LUSCA_HEAD/libasyncio/async_io.c  Wed Jul 22 07:37:20 2009
+++ /branches/LUSCA_HEAD/libasyncio/async_io.c  Sun Aug  9 21:22:14 2009
@@ -100,16 +100,7 @@
      dlink_node node;
  } squidaio_ctrl_t;

-static struct {
-    int open;
-    int close;
-    int cancel;
-    int write;
-    int read;
-    int stat;
-    int unlink;
-    int check_callback;
-} squidaio_counts;
+struct squidaio_stat squidaio_counts;

  typedef struct squidaio_unlinkq_t {
      char *path;
@@ -131,10 +122,6 @@
      if (initialised)
        return;
      squidaio_ctrl_pool = memPoolCreate("aio_ctrl",  
sizeof(squidaio_ctrl_t));
-#if 0
-    cachemgrRegister("squidaio_counts", "Async IO Function Counters",
-       aioStats, 0, 1);
-#endif
      initialised = 1;
  }

@@ -482,25 +469,6 @@
      }
      return retval;
  }
-
-#if 0
-void
-aioStats(StoreEntry * sentry)
-{
-    storeAppendPrintf(sentry, "ASYNC IO Counters:\n");
-    storeAppendPrintf(sentry, "Operation\t# Requests\n");
-    storeAppendPrintf(sentry, "open\t%d\n", squidaio_counts.open);
-    storeAppendPrintf(sentry, "close\t%d\n", squidaio_counts.close);
-    storeAppendPrintf(sentry, "cancel\t%d\n", squidaio_counts.cancel);
-    storeAppendPrintf(sentry, "write\t%d\n", squidaio_counts.write);
-    storeAppendPrintf(sentry, "read\t%d\n", squidaio_counts.read);
-    storeAppendPrintf(sentry, "stat\t%d\n", squidaio_counts.stat);
-    storeAppendPrintf(sentry, "unlink\t%d\n", squidaio_counts.unlink);
-    storeAppendPrintf(sentry, "check_callback\t%d\n",  
squidaio_counts.check_callback);
-    storeAppendPrintf(sentry, "queue\t%d\n", squidaio_get_queue_len());
-    squidaio_stats(sentry);
-}
-#endif

  /*!
   * @function
=======================================
--- /branches/LUSCA_HEAD/libasyncio/async_io.h  Wed Jul 22 07:37:20 2009
+++ /branches/LUSCA_HEAD/libasyncio/async_io.h  Sun Aug  9 21:22:14 2009
@@ -12,6 +12,19 @@
  extern int squidaio_magic1;
  extern int squidaio_magic2;

+struct squidaio_stat {
+    int open;
+    int close;
+    int cancel;
+    int write;
+    int read;
+    int stat;
+    int unlink;
+    int check_callback;
+};
+
+extern struct squidaio_stat squidaio_counts;
+
  /* Base number of threads if not specified to configure.
   * Weighted by number of directories (see aiops.c) */
  #define THREAD_FACTOR 16
=======================================
--- /branches/LUSCA_HEAD/src/stat.c     Sat Mar 28 15:47:13 2009
+++ /branches/LUSCA_HEAD/src/stat.c     Sun Aug  9 21:22:14 2009
@@ -36,6 +36,9 @@

  #include "squid.h"

+#include "../libasyncio/async_io.h"    /* For stats */
+#include "../libasyncio/aiops.h"       /* For stats */
+
  typedef int STOBJFLT(const StoreEntry *);
  typedef struct {
      StoreEntry *sentry;
@@ -74,6 +77,7 @@
  static OBJH statCountersHistograms;
  static OBJH statClientRequests;
  static OBJH statCurrentStuff;
+static OBJH aioStats;

  #ifdef XMALLOC_STATISTICS
  static void info_get_mallstat(int, int, int, void *);
@@ -960,6 +964,7 @@
        statClientRequests, 0, 1);
      cachemgrRegister("iapp_stats", "libiapp statistics", statIappStats, 0,  
1);
      cachemgrRegister("curcounters", "current high level counters",  
statCurrentStuff, 0, 1);
+    cachemgrRegister("squidaio_counts", "Async IO Function Counters",  
aioStats, 0, 1);
  }

  static void
@@ -1656,3 +1661,35 @@
  {
      return memTotalAllocated();
  }
+
+/*
+ * Only if asyncio is compiled in
+ */
+void
+aioStats(StoreEntry * sentry)
+{
+    squidaio_thread_t *threadp;
+    int i;
+
+    storeAppendPrintf(sentry, "ASYNC IO Counters:\n");
+    storeAppendPrintf(sentry, "Operation\t# Requests\n");
+    storeAppendPrintf(sentry, "open\t%d\n", squidaio_counts.open);
+    storeAppendPrintf(sentry, "close\t%d\n", squidaio_counts.close);
+    storeAppendPrintf(sentry, "cancel\t%d\n", squidaio_counts.cancel);
+    storeAppendPrintf(sentry, "write\t%d\n", squidaio_counts.write);
+    storeAppendPrintf(sentry, "read\t%d\n", squidaio_counts.read);
+    storeAppendPrintf(sentry, "stat\t%d\n", squidaio_counts.stat);
+    storeAppendPrintf(sentry, "unlink\t%d\n", squidaio_counts.unlink);
+    storeAppendPrintf(sentry, "check_callback\t%d\n",  
squidaio_counts.check_callback);
+    storeAppendPrintf(sentry, "queue\t%d\n", squidaio_get_queue_len());
+
+
+    storeAppendPrintf(sentry, "\n\nThreads Status:\n");
+    storeAppendPrintf(sentry, "#\tID\t# Requests\n");
+
+    threadp = squidaio_get_thread_head();
+    for (i = 0; i < squidaio_nthreads; i++) {
+        storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1,  
threadp->thread, threadp->requests);
+        threadp = threadp->next;
+    }
+}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to