]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
client active requests cachemgr page
authorwessels <>
Thu, 10 Dec 1998 06:00:58 +0000 (06:00 +0000)
committerwessels <>
Thu, 10 Dec 1998 06:00:58 +0000 (06:00 +0000)
src/client_side.cc
src/globals.h
src/stat.cc
src/structs.h

index 0c8e5e06000626d0c3efac0b7052ab6fd600c688..c2506b223f001738d5e53e84d6d71801154de199 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.424 1998/12/05 00:54:18 wessels Exp $
+ * $Id: client_side.cc,v 1.425 1998/12/09 23:00:58 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -716,6 +716,7 @@ httpRequestFree(void *data)
     assert(*H != NULL);
     *H = http->next;
     http->next = NULL;
+    dlinkDelete(&http->active, &ClientActiveRequests);
     cbdataFree(http);
 }
 
@@ -1467,6 +1468,8 @@ clientSendMoreData(void *data, char *buf, ssize_t size)
     debug(33, 5) ("clientSendMoreData: %s, %d bytes\n", http->uri, (int) size);
     assert(size <= CLIENT_SOCK_SZ);
     assert(http->request != NULL);
+    dlinkDelete(&http->active, &ClientActiveRequests);
+    dlinkAdd(http, &http->active, &ClientActiveRequests);
     debug(33, 5) ("clientSendMoreData: FD %d '%s', out.offset=%d \n",
        fd, storeUrl(entry), (int) http->out.offset);
     if (conn->chr != http) {
@@ -1897,6 +1900,7 @@ parseHttpRequestAbort(ConnStateData * conn, const char *uri)
     http->uri = xstrdup(uri);
     http->log_uri = xstrndup(uri, MAX_URL);
     http->range_iter.boundary = StringNull;
+    dlinkAdd(http, &http->active, &ClientActiveRequests);
     return http;
 }
 
@@ -2030,6 +2034,7 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status,
     *prefix_p = xmalloc(prefix_sz + 1);
     xmemcpy(*prefix_p, conn->in.buf, prefix_sz);
     *(*prefix_p + prefix_sz) = '\0';
+    dlinkAdd(http, &http->active, &ClientActiveRequests);
 
     debug(33, 5) ("parseHttpRequest: Request Header is\n%s\n", (*prefix_p) + *req_line_sz_p);
     if ((t = strchr(url, '#')))        /* remove HTML anchors */
index 994d513115118478fa1ebc0b1b955623b748abd7..80be0c8ff09437c594ffb490b9a3e03bf76bc563 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.73 1998/12/05 07:17:07 wessels Exp $
+ * $Id: globals.h,v 1.74 1998/12/09 23:01:00 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -123,6 +123,7 @@ extern double current_dtime;
 extern int store_hash_buckets; /* 0 */
 extern hash_table *store_table;        /* NULL */
 extern dlink_list store_list;
+extern dlink_list ClientActiveRequests;
 extern const String StringNull;        /* { 0, 0, NULL } */
 extern const MemBuf MemBufNull;        /* MemBufNULL */
 extern int hot_obj_count;      /* 0 */
index 48cad8e62e351a6b9cfd2a4a3cc018b644852cfa..050e23978a4f283400f293ee58495f193d9f0446 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.301 1998/12/05 00:54:41 wessels Exp $
+ * $Id: stat.cc,v 1.302 1998/12/09 23:01:02 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -76,6 +76,7 @@ static OBJH statAvg5min;
 static OBJH statAvg60min;
 static OBJH statUtilization;
 static OBJH statCountersHistograms;
+static OBJH statClientRequests;
 
 #ifdef XMALLOC_STATISTICS
 static void info_get_mallstat(int, int, StoreEntry *);
@@ -271,7 +272,7 @@ statStoreEntry(StoreEntry * s, StoreEntry * e)
        for (i = 0, sc = &mem->clients[i]; sc != NULL; sc = sc->next, i++) {
            if (sc->callback_data == NULL)
                continue;
-           storeAppendPrintf(s, "\tClient #%d\n", i);
+           storeAppendPrintf(s, "\tClient #%d, %p\n", i, sc->callback_data);
            storeAppendPrintf(s, "\t\tcopy_offset: %d\n",
                (int) sc->copy_offset);
            storeAppendPrintf(s, "\t\tseen_offset: %d\n",
@@ -847,6 +848,11 @@ statInit(void)
     cachemgrRegister("histograms",
        "Full Histogram Counts",
        statCountersHistograms, 0, 1);
+    ClientActiveRequests.head = NULL;
+    ClientActiveRequests.tail = NULL;
+    cachemgrRegister("active_requests",
+       "Client-side Active Requests",
+       statClientRequests, 0, 1);
 }
 
 static void
@@ -1276,6 +1282,54 @@ statByteHitRatio(int minutes)
        return (-1.0 * dpercent(s - c, c));
 }
 
+static void
+statClientRequests(StoreEntry * s)
+{
+    dlink_node *i;
+    clientHttpRequest *http;
+    ConnStateData *conn;
+    StoreEntry *e;
+    int fd;
+    for (i = ClientActiveRequests.head; i; i = i->next) {
+       http = i->data;
+       assert(http);
+       conn = http->conn;
+       storeAppendPrintf(s, "Connection: %p\n", conn);
+       if (conn) {
+           fd = conn->fd;
+           storeAppendPrintf(s, "\tFD %d, read %d, wrote %d\n", fd,
+               fd_table[fd].bytes_read, fd_table[fd].bytes_written);
+           storeAppendPrintf(s, "\tFD desc: %s\n", fd_table[fd].desc);
+           storeAppendPrintf(s, "\tin: buf %p, offset %d, size %d\n",
+               conn->in.buf, conn->in.offset, conn->in.size);
+           storeAppendPrintf(s, "\tpeer: %s:%d\n",
+               inet_ntoa(conn->peer.sin_addr),
+               ntohs(conn->peer.sin_port));
+           storeAppendPrintf(s, "\tme: %s:%d\n",
+               inet_ntoa(conn->me.sin_addr),
+               ntohs(conn->me.sin_port));
+           storeAppendPrintf(s, "\tnrequests: %d\n",
+               conn->nrequests);
+           storeAppendPrintf(s, "\tpersistent: %d\n",
+               conn->persistent);
+           storeAppendPrintf(s, "\tdefer: n %d, until %d\n",
+               conn->defer.n, conn->defer.until);
+       }
+       storeAppendPrintf(s, "uri %s\n", http->uri);
+       storeAppendPrintf(s, "out.offset %d, out.size %d\n",
+           http->out.offset, http->out.size);
+       storeAppendPrintf(s, "req_sz %d\n", http->req_sz);
+       e = http->entry;
+       storeAppendPrintf(s, "entry %p/%s\n", e, e ? storeKeyText(e->key) : "N/A");
+       e = http->old_entry;
+       storeAppendPrintf(s, "old_entry %p/%s\n", e, e ? storeKeyText(e->key) : "N/A");
+       storeAppendPrintf(s, "start %d.%06d (%f seconds ago)\n", http->start.tv_sec,
+           http->start.tv_usec,
+           tvSubDsec(http->start, current_time));
+       storeAppendPrintf(s, "\n");
+    }
+}
+
 #if STAT_GRAPHS
 /*
  * urgh, i don't like these, but they do cut the amount of code down immensely
index a70d25da387601b05f1be1a391186b43b3c15d63..56cd971a8fea536f1ca9c36c1afc9e7fe21c38ca 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: structs.h,v 1.251 1998/12/05 00:54:46 wessels Exp $
+ * $Id: structs.h,v 1.252 1998/12/09 23:01:03 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
  *
  */
 
+struct _dlink_node {
+    void *data;
+    dlink_node *prev;
+    dlink_node *next;
+};
+
+struct _dlink_list {
+    dlink_node *head;
+    dlink_node *tail;
+};
+
 struct _acl_ip_data {
     struct in_addr addr1;      /* if addr2 non-zero then its a range */
     struct in_addr addr2;
@@ -787,6 +798,7 @@ struct _clientHttpRequest {
        http_status status;
        char *location;
     } redirect;
+    dlink_node active;
 };
 
 struct _ConnStateData {
@@ -816,17 +828,6 @@ struct _ConnStateData {
     } defer;
 };
 
-struct _dlink_node {
-    void *data;
-    dlink_node *prev;
-    dlink_node *next;
-};
-
-struct _dlink_list {
-    dlink_node *head;
-    dlink_node *tail;
-};
-
 struct _ipcache_addrs {
     struct in_addr *in_addrs;
     unsigned char *bad_mask;