]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
instrumented persistent connection counter histogram
authorwessels <>
Sat, 9 Aug 1997 11:42:31 +0000 (11:42 +0000)
committerwessels <>
Sat, 9 Aug 1997 11:42:31 +0000 (11:42 +0000)
ChangeLog
src/enums.h
src/main.cc
src/protos.h
src/stat.cc

index 5e33e03650ff294e5dd92799fabad26f01552530..dea9b843d62d20fefec19c375b61aca1fcc56e41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
        - Simpler cacheobj implementation.
+       - persistent connection histogram
 
 Changes to squid-1.2.alpha5 ():
 
index 5c0681a0ffcb5f130a6b53e65cd64ea6c995c9dc..b5f73d5b909b95c9100c6a1d43c2ff98864300cf 100644 (file)
@@ -145,6 +145,7 @@ typedef enum {
     MGR_VM_OBJECTS,
     MGR_STOREDIR,
     MGR_CBDATA,
+    MGR_PCONN,
     MGR_MAX
 } objcache_op;
 
index 1ee1d3339602c91a004725c565067e16bb3f81f6..c41e87b73da4d66b6bc1f753cc89c280233f0995 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.170 1997/07/28 06:40:59 wessels Exp $
+ * $Id: main.cc,v 1.171 1997/08/09 05:42:34 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -504,6 +504,7 @@ mainInitialize(void)
        urlInitialize();
        stat_init(&HTTPCacheInfo, Config.Log.access);
        stat_init(&ICPCacheInfo, NULL);
+       objcacheInit();
        storeInit();
 
        if (Config.effectiveUser) {
index 71dda84be3f6d309e26f70e924af486efbe3cfd4..11d5aea64cfe8dfe603df2bddafb42c3b93df64a 100644 (file)
@@ -341,8 +341,7 @@ extern void netdbUpdatePeer _PARAMS((request_t *, peer * e, int rtt, int hops));
 extern void objcachePasswdAdd _PARAMS((cachemgr_passwd **, char *, wordlist *));
 extern void objcachePasswdDestroy _PARAMS((cachemgr_passwd ** a));
 extern void objcacheStart _PARAMS((int fd, StoreEntry *));
-
-
+extern void objcacheInit _PARAMS((void));
 
 extern void peerSelect _PARAMS((request_t *, StoreEntry *, PSC *, PSC *, void *data));
 extern peer *peerGetSomeParent _PARAMS((request_t *, hier_code *));
@@ -387,6 +386,7 @@ extern void init_stack _PARAMS((Stack *, int));
 extern void stackFreeMemory _PARAMS((Stack *));
 
 extern void stat_init _PARAMS((cacheinfo **, const char *));
+extern void pconnHistCount _PARAMS((int, int));
 
 /* To reduce memory fragmentation, we now store the memory version of an
  * object in fixed size blocks of size PAGE_SIZE and instead of calling 
@@ -555,3 +555,4 @@ extern OBJH info_get;
 extern OBJH server_list;
 extern OBJH parameter_get;
 extern OBJH storeDirStats;
+extern OBJH pconnHistDump;
index db974c9d655c9032cf97c36cfac93c7be6cbc88f..feb1e202f80ae91d0939cfcd0a3e1b7ec1ac4a25 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.151 1997/08/09 04:48:09 wessels Exp $
+ * $Id: stat.cc,v 1.152 1997/08/09 05:42:36 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -137,6 +137,9 @@ static int memoryAccounted _PARAMS((void));
 static void info_get_mallstat _PARAMS((int, int, StoreEntry *));
 #endif
 
+#define PCONN_HIST_SZ 256
+int client_pconn_hist[PCONN_HIST_SZ];
+
 /* process utilization information */
 static void
 statUtilization(cacheinfo * obj, StoreEntry * sentry, const char *desc)
@@ -837,7 +840,6 @@ stat_init(cacheinfo ** object, const char *logfilename)
 {
     cacheinfo *obj = NULL;
     int i;
-
     debug(18, 5) ("stat_init: Initializing...\n");
     obj = xcalloc(1, sizeof(cacheinfo));
     if (logfilename)
@@ -885,4 +887,33 @@ stat_init(cacheinfo ** object, const char *logfilename)
        obj->proto_stat_data[i].kb.now = 0;
     }
     *object = obj;
+       for (i=0; i<PCONN_HIST_SZ; i++)
+               client_pconn_hist[i] = 0;
+}
+
+void
+pconnHistCount(int what, int i)
+{
+    if (i >= PCONN_HIST_SZ)
+       i = PCONN_HIST_SZ - 1;
+    /* what == 0 for client, 1 for server */
+    if (what == 0)
+       client_pconn_hist[i]++;
+}
+
+void
+pconnHistDump(StoreEntry * e)
+{
+    int i;
+    storeAppendPrintf(e,
+       "Client-side persistent connection counts:\n"
+       "\n"
+       "req/\n"
+       "conn      count\n"
+       "----  ---------\n");
+    for (i = 0; i < PCONN_HIST_SZ; i++) {
+       if (client_pconn_hist[i] == 0)
+           continue;
+       storeAppendPrintf(e, "%4d  %9d\n", i, client_pconn_hist[i]);
+    }
 }