/*
- * $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
assert(*H != NULL);
*H = http->next;
http->next = NULL;
+ dlinkDelete(&http->active, &ClientActiveRequests);
cbdataFree(http);
}
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) {
http->uri = xstrdup(uri);
http->log_uri = xstrndup(uri, MAX_URL);
http->range_iter.boundary = StringNull;
+ dlinkAdd(http, &http->active, &ClientActiveRequests);
return http;
}
*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 */
/*
- * $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
static OBJH statAvg60min;
static OBJH statUtilization;
static OBJH statCountersHistograms;
+static OBJH statClientRequests;
#ifdef XMALLOC_STATISTICS
static void info_get_mallstat(int, int, StoreEntry *);
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",
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
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