of byte counters for the server-side (http,ftp,gopher,wais,ssl,pass).
- Also separately track cache hits, misses, and not-modified replies.
- Try to track ICP query service time, but this may not be implemented
right.
- Removed '60min' average, now we have 5 minutes max
/*
- * $Id: access_log.cc,v 1.22 1998/02/20 18:47:49 wessels Exp $
+ * $Id: access_log.cc,v 1.23 1998/02/24 21:17:01 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
"TCP_REFRESH_HIT",
"TCP_REF_FAIL_HIT",
"TCP_REFRESH_MISS",
- "TCP_CLIENT_REFRESH",
+ "TCP_CLIENT_REFRESH_MISS",
"TCP_IMS_HIT",
"TCP_IMS_MISS",
"TCP_SWAPFAIL_MISS",
/*
- * $Id: client_side.cc,v 1.213 1998/02/23 23:47:21 rousskov Exp $
+ * $Id: client_side.cc,v 1.214 1998/02/24 21:17:02 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
static const char *const crlf = "\r\n";
static const char *const proxy_auth_challenge =
- "Basic realm=\"Squid proxy-caching web server\"";
+"Basic realm=\"Squid proxy-caching web server\"";
#define REQUEST_BUF_SIZE 4096
#define FAILURE_MODE_TIME 300
aclNBCheck(http->acl_checklist, clientAccessCheckDone, http);
}
-#if 0 /* reimplemented using new interfaces */
+#if 0 /* reimplemented using new interfaces */
static char *
clientConstructProxyAuthReply(clientHttpRequest * http)
{
#endif
static HttpReply *
-clientConstructProxyAuthReply(clientHttpRequest *http)
+clientConstructProxyAuthReply(clientHttpRequest * http)
{
ErrorState *err = errorCon(ERR_CACHE_ACCESS_DENIED, HTTP_PROXY_AUTHENTICATION_REQUIRED);
HttpReply *rep;
storeRelease(entry);
http->http_code = HTTP_OK;
}
-#if 0 /* new interface */
+#if 0 /* new interface */
msg = httpReplyHeader(1.0, http->http_code, NULL, 0, 0, -1);
if ((int) strlen(msg) < 8190)
strcat(msg, "\r\n");
void
clientUpdateCounters(clientHttpRequest * http)
{
+ int svc_time = tvSubMsec(http->start, current_time);
+ icp_ping_data *i;
Counter.client_http.requests++;
kb_incr(&Counter.client_http.kbytes_in, http->req_sz);
kb_incr(&Counter.client_http.kbytes_out, http->out.size);
}
if (http->request->err_type != ERR_NONE)
Counter.client_http.errors++;
- statLogHistCount(&Counter.client_http.svc_time,
- tvSubMsec(http->start, current_time));
+ statLogHistCount(&Counter.client_http.all_svc_time, svc_time);
+ /*
+ * The idea here is not to be complete, but to get service times
+ * for only well-defined types. For example, we don't include
+ * LOG_TCP_REFRESH_FAIL_HIT because its not really a cache hit
+ * (we *tried* to validate it, but failed).
+ */
+ switch (http->log_type) {
+ case LOG_TCP_IMS_HIT:
+ statLogHistCount(&Counter.client_http.nm_svc_time, svc_time);
+ break;
+ case LOG_TCP_HIT:
+ case LOG_TCP_MEM_HIT:
+ statLogHistCount(&Counter.client_http.hit_svc_time, svc_time);
+ break;
+ case LOG_TCP_MISS:
+ case LOG_TCP_CLIENT_REFRESH_MISS:
+ statLogHistCount(&Counter.client_http.miss_svc_time, svc_time);
+ break;
+ default:
+ /* make compiler warnings go away */
+ break;
+ }
+ i = &http->request->hier.icp;
+ if (0 != i->stop.tv_sec)
+ statLogHistCount(&Counter.icp.query_svc_time, tvSubUsec(i->start, i->stop));
}
static void
return;
}
debug(33, 4) ("clientGetHeadersForIMS: Not modified '%s'\n", storeUrl(entry));
-#if 0 /* use new interfaces */
+#if 0 /* use new interfaces */
reply = clientConstruct304reply(mem->reply);
comm_write(http->conn->fd,
xstrdup(reply),
storeRelease(e);
ipcacheReleaseInvalid(r->host);
http->entry = NULL;
- return LOG_TCP_CLIENT_REFRESH;
+ return LOG_TCP_CLIENT_REFRESH_MISS;
} else if (checkNegativeHit(e)) {
return LOG_TCP_NEGATIVE_HIT;
} else if (refreshCheck(e, r, 0)) {
http->entry = clientCreateStoreEntry(http, r->method, 0);
storeReleaseRequest(http->entry);
storeBuffer(http->entry);
-#if 0 /* use new interface */
+#if 0 /* use new interface */
hdr = httpReplyHeader(1.0,
HTTP_OK,
"text/plain",
return 1;
}
-#if 0 /* moved to HttpReply */
+#if 0 /* moved to HttpReply */
static char *
-clientConstruct304reply(http_reply *source)
+clientConstruct304reply(http_reply * source)
{
LOCAL_ARRAY(char, line, 256);
LOCAL_ARRAY(char, reply, 8192);
LOG_TCP_REFRESH_HIT,
LOG_TCP_REFRESH_FAIL_HIT,
LOG_TCP_REFRESH_MISS,
- LOG_TCP_CLIENT_REFRESH,
+ LOG_TCP_CLIENT_REFRESH_MISS,
LOG_TCP_IMS_HIT,
LOG_TCP_IMS_MISS,
LOG_TCP_SWAPFAIL_MISS,
HTTP_SERVICE_UNAVAILABLE = 503,
HTTP_GATEWAY_TIMEOUT = 504,
HTTP_HTTP_VERSION_NOT_SUPPORTED = 505,
- HTTP_INVALID_HEADER = 600 /* Squid header parsing error */
+ HTTP_INVALID_HEADER = 600 /* Squid header parsing error */
} http_status;
/* These are for StoreEntry->flag, which is defined as a SHORT */
MEM_FQDNCACHE_ENTRY,
MEM_HASH_LINK,
MEM_HASH_TABLE,
-#if 0 /* renamed to detect all old uses */
+#if 0 /* renamed to detect all old uses */
MEM_HTTP_REPLY,
#else
MEM_HTTPREPLY,
/*
- * $Id: ftp.cc,v 1.196 1998/02/22 07:45:19 rousskov Exp $
+ * $Id: ftp.cc,v 1.197 1998/02/24 21:17:03 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
#if 0
static char *ftpAuthRequired(const request_t *, const char *);
#else
-static void ftpAuthRequired(HttpReply *reply, request_t *request, const char *realm);
+static void ftpAuthRequired(HttpReply * reply, request_t * request, const char *realm);
#endif
static STABH ftpAbort;
static void ftpHackShortcut(FtpStateData * ftpState, FTPSM * nextState);
len = read(fd,
ftpState->data.buf + ftpState->data.offset,
ftpState->data.size - ftpState->data.offset);
- fd_bytes(fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, len);
if (len > 0) {
IOStats.Ftp.reads++;
}
}
-#if 0 /* moved to mime.c because cachemgr needs it too */
+#if 0 /* moved to mime.c because cachemgr needs it too */
static char *
ftpGetBasicAuth(const char *req_hdr)
{
StoreEntry *entry = ftpState->entry;
ErrorState *err;
debug(9, 7) ("ftpWriteCommandCallback: wrote %d bytes\n", size);
+ if (size > 0) {
+ fd_bytes(fd, size, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, size);
+ }
if (errflag == COMM_ERR_CLOSING)
return;
if (errflag) {
len = read(fd,
ftpState->ctrl.buf + ftpState->ctrl.offset,
ftpState->ctrl.size - ftpState->ctrl.offset);
- fd_bytes(fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, len);
if (len < 0) {
debug(50, 1) ("ftpReadControlReply: read error: %s\n", xstrerror());
}
}
storeBuffer(e);
-#if 0 /* old code */
+#if 0 /* old code */
storeAppendPrintf(e, "HTTP/1.0 200 Gatewaying\r\n");
reply->code = 200;
reply->version = 1.0;
comm_close(ftpState->ctrl.fd);
}
-#if 0 /* use new interfaces instead */
+#if 0 /* use new interfaces instead */
static char *
ftpAuthRequired(const request_t * request, const char *realm)
{
#endif
static void
-ftpAuthRequired(HttpReply *old_reply, request_t *request, const char *realm)
+ftpAuthRequired(HttpReply * old_reply, request_t * request, const char *realm)
{
ErrorState *err = errorCon(ERR_ACCESS_DENIED, HTTP_UNAUTHORIZED);
HttpReply *rep;
/*
- * $Id: gopher.cc,v 1.118 1998/01/12 04:30:02 wessels Exp $
+ * $Id: gopher.cc,v 1.119 1998/02/24 21:17:04 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
errno = 0;
/* leave one space for \0 in gopherToHTML */
len = read(fd, buf, TEMP_BUF_SIZE - 1);
- fd_bytes(fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(10, 5) ("gopherReadReply: FD %d read len=%d\n", fd, len);
if (len > 0) {
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
StoreEntry *entry = gopherState->entry;
debug(10, 5) ("gopherSendComplete: FD %d size: %d errflag: %d\n",
fd, size, errflag);
+ if (size > 0) {
+ fd_bytes(fd, size, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, size);
+ }
if (errflag) {
ErrorState *err;
err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
/*
- * $Id: http.cc,v 1.240 1998/02/21 18:46:36 rousskov Exp $
+ * $Id: http.cc,v 1.241 1998/02/24 21:17:05 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static const char *const crlf = "\r\n";
-#if 0 /* moved to HttpHeader */
+#if 0 /* moved to HttpHeader */
typedef enum {
SCC_PUBLIC,
SCC_PRIVATE,
SCC_MAXAGE,
SCC_ENUM_END
} http_server_cc_t;
+
#endif
enum {
CCC_ENUM_END
};
-#if 0 /* moved to HttpHeader.h */
+#if 0 /* moved to HttpHeader.h */
typedef enum {
HDR_ACCEPT,
HDR_AGE,
int misc[HDR_MISC_END];
int cc[SCC_ENUM_END];
} ReplyHeaderStats;
+
#endif /* if 0 */
static CNCB httpConnectDone;
static void httpCacheNegatively(StoreEntry *);
static void httpMakePrivate(StoreEntry *);
static void httpMakePublic(StoreEntry *);
-#if 0 /* moved to HttpResponse */
+#if 0 /* moved to HttpResponse */
static char *httpStatusString(int status);
#endif
static STABH httpAbort;
/* Parse headers into reply structure */
/* Old code never parsed headers if mime_headers_end failed, was it intentional ? @?@ @?@ */
/* what happens if we fail to parse here? @?@ @?@ */
- httpReplyParse(reply, httpState->reply_hdr); /* httpState->eof); */
+ httpReplyParse(reply, httpState->reply_hdr); /* httpState->eof); */
storeTimestampsSet(entry);
/* Check if object is cacheable or not based on reply code */
debug(11, 3) ("httpProcessReplyHeader: HTTP CODE: %d\n", reply->sline.status);
clen = entry->mem_obj->inmem_hi;
errno = 0;
len = read(fd, buf, SQUID_TCP_SO_RCVBUF);
- fd_bytes(fd, len, FD_READ);
debug(11, 5) ("httpReadReply: FD %d: len %d.\n", fd, len);
if (len > 0) {
+ fd_bytes(fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
IOStats.Http.reads++;
for (clen = len - 1, bin = 0; clen; bin++)
ErrorState *err;
debug(11, 5) ("httpSendComplete: FD %d: size %d: errflag %d.\n",
fd, size, errflag);
+ if (size > 0) {
+ fd_bytes(fd, size, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, size);
+ }
if (errflag == COMM_ERR_CLOSING)
return;
if (errflag) {
}
}
-#if 0 /* moved to httpHeader */
+#if 0 /* moved to httpHeader */
void
httpReplyHeaderStats(StoreEntry * entry)
{
comm_close(httpState->fd);
}
-#if 0 /* moved to httpResponse.c */
+#if 0 /* moved to httpResponse.c */
static char *
httpStatusString(int status)
{
}
#endif
-#if 0 /* moved to HttpResponse.c */
+#if 0 /* moved to HttpResponse.c */
char *
httpReplyHeader(double ver,
http_status status,
UdpQueueHead = queue->next;
if (queue->logcode) {
icpLogIcp(queue);
- statLogHistCount(&Counter.icp.svc_time,
+ statLogHistCount(&Counter.icp.reply_svc_time,
tvSubUsec(queue->start, current_time));
}
safe_free(queue->msg);
/*
- * $Id: peer_select.cc,v 1.37 1998/02/03 04:21:19 wessels Exp $
+ * $Id: peer_select.cc,v 1.38 1998/02/24 21:17:07 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
eventDelete(peerPingTimeout, psstate);
entry->ping_status = PING_DONE;
}
+ psstate->icp.stop = current_time;
if (cbdataValid(data))
psstate->callback(p, data);
cbdataUnlock(data);
/*
- * $Id: ssl.cc,v 1.73 1998/01/12 04:30:11 wessels Exp $
+ * $Id: ssl.cc,v 1.74 1998/02/24 21:17:07 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
SslStateData *sslState = data;
int len;
len = read(sslState->server.fd, sslState->server.buf, SQUID_TCP_SO_RCVBUF);
- fd_bytes(sslState->server.fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(sslState->server.fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(26, 5) ("sslReadServer FD %d, read %d bytes\n", fd, len);
if (len < 0) {
debug(50, 1) ("sslReadServer: FD %d: read failure: %s\n",
SslStateData *sslState = data;
int len;
len = read(sslState->client.fd, sslState->client.buf, SQUID_TCP_SO_RCVBUF);
- fd_bytes(sslState->client.fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(sslState->client.fd, len, FD_READ);
+ kb_incr(&Counter.client_http.kbytes_in, len);
+ }
debug(26, 5) ("sslReadClient FD %d, read %d bytes\n",
sslState->client.fd, len);
if (len < 0) {
len = write(sslState->server.fd,
sslState->client.buf + sslState->client.offset,
sslState->client.len - sslState->client.offset);
- fd_bytes(fd, len, FD_WRITE);
+ if (len > 0) {
+ fd_bytes(sslState->server.fd, len, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, len);
+ }
debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
if (ignoreErrno(errno)) {
len = write(sslState->client.fd,
sslState->server.buf + sslState->server.offset,
sslState->server.len - sslState->server.offset);
- fd_bytes(fd, len, FD_WRITE);
+ if (len > 0) {
+ fd_bytes(sslState->client.fd, len, FD_WRITE);
+ kb_incr(&Counter.client_http.kbytes_out, len);
+ }
debug(26, 5) ("sslWriteClient FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
if (ignoreErrno(errno)) {
/*
- * $Id: stat.cc,v 1.203 1998/02/22 12:05:24 kostas Exp $
+ * $Id: stat.cc,v 1.204 1998/02/24 21:17:08 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
static OBJH statFiledescriptors;
static OBJH statCounters;
static OBJH statAvg5min;
-static OBJH statAvg60min;
#ifdef XMALLOC_STATISTICS
static void info_get_mallstat(int, int, StoreEntry *);
/*
* An hour's worth, plus the 'current' counter
*/
-#define N_COUNT_HIST 61
+#define N_COUNT_HIST 6
StatCounters CountHist[N_COUNT_HIST];
static int NCountHist = 0;
squid_getrusage(&rusage);
f->page_faults = rusage_pagefaults(&rusage);
f->cputime = rusage_cputime(&rusage);
+
storeAppendPrintf(sentry, "client_http.requests = %d\n",
f->client_http.requests);
storeAppendPrintf(sentry, "client_http.hits = %d\n",
(int) f->client_http.kbytes_in.kb);
storeAppendPrintf(sentry, "client_http.kbytes_out = %d\n",
(int) f->client_http.kbytes_out.kb);
- storeAppendPrintf(sentry, "client_http.svc_time histogram:\n");
- statLogHistDump(sentry, &f->client_http.svc_time);
+ storeAppendPrintf(sentry, "client_http.all_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->client_http.all_svc_time);
+ storeAppendPrintf(sentry, "client_http.miss_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->client_http.miss_svc_time);
+ storeAppendPrintf(sentry, "client_http.nm_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->client_http.nm_svc_time);
+ storeAppendPrintf(sentry, "client_http.hit_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->client_http.hit_svc_time);
+
+ storeAppendPrintf(sentry, "server.requests = %d\n",
+ (int) f->server.requests);
+ storeAppendPrintf(sentry, "server.errors = %d\n",
+ (int) f->server.errors);
+ storeAppendPrintf(sentry, "server.kbytes_in = %d\n",
+ (int) f->server.kbytes_in.kb);
+ storeAppendPrintf(sentry, "server.kbytes_out = %d\n",
+ (int) f->server.kbytes_out.kb);
+
storeAppendPrintf(sentry, "icp.pkts_sent = %d\n",
f->icp.pkts_sent);
storeAppendPrintf(sentry, "icp.pkts_recv = %d\n",
(int) f->icp.kbytes_sent.kb);
storeAppendPrintf(sentry, "icp.kbytes_recv = %d\n",
(int) f->icp.kbytes_recv.kb);
- storeAppendPrintf(sentry, "icp.svc_time histogram:\n");
- statLogHistDump(sentry, &f->icp.svc_time);
+ storeAppendPrintf(sentry, "icp.query_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->icp.query_svc_time);
+ storeAppendPrintf(sentry, "icp.reply_svc_time histogram:\n");
+ statLogHistDump(sentry, &f->icp.reply_svc_time);
+
storeAppendPrintf(sentry, "dns.svc_time histogram:\n");
statLogHistDump(sentry, &f->dns.svc_time);
storeAppendPrintf(sentry, "unlink.requests = %d\n",
l = &CountHist[minutes];
dt = tvSubDsec(l->timestamp, f->timestamp);
ct = f->cputime - l->cputime;
+
storeAppendPrintf(sentry, "client_http.requests = %f/sec\n",
XAVG(client_http.requests));
storeAppendPrintf(sentry, "client_http.hits = %f/sec\n",
XAVG(client_http.kbytes_in.kb));
storeAppendPrintf(sentry, "client_http.kbytes_out = %f/sec\n",
XAVG(client_http.kbytes_out.kb));
- x = statLogHistDeltaMedian(&l->client_http.svc_time, &f->client_http.svc_time);
- storeAppendPrintf(sentry, "client_http.median_svc_time = %f seconds\n",
+
+ x = statLogHistDeltaMedian(&l->client_http.all_svc_time,
+ &f->client_http.all_svc_time);
+ storeAppendPrintf(sentry, "client_http.all_median_svc_time = %f seconds\n",
+ x / 1000.0);
+ x = statLogHistDeltaMedian(&l->client_http.miss_svc_time,
+ &f->client_http.miss_svc_time);
+ storeAppendPrintf(sentry, "client_http.miss_median_svc_time = %f seconds\n",
+ x / 1000.0);
+ x = statLogHistDeltaMedian(&l->client_http.nm_svc_time,
+ &f->client_http.nm_svc_time);
+ storeAppendPrintf(sentry, "client_http.nm_median_svc_time = %f seconds\n",
+ x / 1000.0);
+ x = statLogHistDeltaMedian(&l->client_http.hit_svc_time,
+ &f->client_http.hit_svc_time);
+ storeAppendPrintf(sentry, "client_http.hit_median_svc_time = %f seconds\n",
x / 1000.0);
+
+ storeAppendPrintf(sentry, "server.requests = %f/sec\n",
+ XAVG(server.requests));
+ storeAppendPrintf(sentry, "server.errors = %f/sec\n",
+ XAVG(server.errors));
+ storeAppendPrintf(sentry, "server.kbytes_in = %f/sec\n",
+ XAVG(server.kbytes_in.kb));
+ storeAppendPrintf(sentry, "server.kbytes_out = %f/sec\n",
+ XAVG(server.kbytes_out.kb));
+
storeAppendPrintf(sentry, "icp.pkts_sent = %f/sec\n",
XAVG(icp.pkts_sent));
storeAppendPrintf(sentry, "icp.pkts_recv = %f/sec\n",
XAVG(icp.kbytes_sent.kb));
storeAppendPrintf(sentry, "icp.kbytes_recv = %f/sec\n",
XAVG(icp.kbytes_recv.kb));
- x = statLogHistDeltaMedian(&l->icp.svc_time, &f->icp.svc_time);
- storeAppendPrintf(sentry, "icp.median_svc_time = %f seconds\n",
+ x = statLogHistDeltaMedian(&l->icp.query_svc_time, &f->icp.query_svc_time);
+ storeAppendPrintf(sentry, "icp.query_median_svc_time = %f seconds\n",
+ x / 1000000.0);
+ x = statLogHistDeltaMedian(&l->icp.reply_svc_time, &f->icp.reply_svc_time);
+ storeAppendPrintf(sentry, "icp.reply_median_svc_time = %f seconds\n",
x / 1000000.0);
x = statLogHistDeltaMedian(&l->dns.svc_time, &f->dns.svc_time);
storeAppendPrintf(sentry, "dns.median_svc_time = %f seconds\n",
/*
* HTTP svc_time hist is kept in milli-seconds; max of 3 hours.
*/
- statLogHistInit(&C->client_http.svc_time, 0.0, 3600000.0 * 3.0);
+ statLogHistInit(&C->client_http.all_svc_time, 0.0, 3600000.0 * 3.0);
+ statLogHistInit(&C->client_http.miss_svc_time, 0.0, 3600000.0 * 3.0);
+ statLogHistInit(&C->client_http.nm_svc_time, 0.0, 3600000.0 * 3.0);
+ statLogHistInit(&C->client_http.hit_svc_time, 0.0, 3600000.0 * 3.0);
/*
* ICP svc_time hist is kept in micro-seconds; max of 1 minute.
*/
- statLogHistInit(&C->icp.svc_time, 0.0, 1000000.0 * 60.0);
+ statLogHistInit(&C->icp.query_svc_time, 0.0, 1000000.0 * 60.0);
+ statLogHistInit(&C->icp.reply_svc_time, 0.0, 1000000.0 * 60.0);
/*
* DNS svc_time hist is kept in milli-seconds; max of 10 minutes.
*/
cachemgrRegister("5min",
"5 Minute Average of Counters",
statAvg5min, 0);
- cachemgrRegister("60min",
- "60 Minute Average of Counters",
- statAvg60min, 0);
}
static void
statAvgDump(e, 5);
}
-void
-statAvg60min(StoreEntry * e)
-{
- statAvgDump(e, 60);
-}
-
void
statLogHistInit(StatLogHist * H, double min, double max)
{
return exp(bin / H->scale) + H->min - 1.0;
}
-enum { HTTP_SVC, ICP_SVC, DNS_SVC };
+enum {
+ HTTP_SVC, ICP_SVC, DNS_SVC
+};
-int
+int
get_median_svc(int interval, int which)
{
StatCounters *f;
f = &CountHist[0];
l = &CountHist[interval];
- assert(f);
- assert(l);
+ assert(f);
+ assert(l);
switch (which) {
case HTTP_SVC:
- x = statLogHistDeltaMedian(&l->client_http.svc_time, &f->client_http.svc_time);
- break;
+ x = statLogHistDeltaMedian(&l->client_http.all_svc_time, &f->client_http.all_svc_time);
+ break;
case ICP_SVC:
- x = statLogHistDeltaMedian(&l->icp.svc_time, &f->icp.svc_time);
- break;
+ x = statLogHistDeltaMedian(&l->icp.query_svc_time, &f->icp.query_svc_time);
+ break;
case DNS_SVC:
- x = statLogHistDeltaMedian(&l->dns.svc_time, &f->dns.svc_time);
- break;
+ x = statLogHistDeltaMedian(&l->dns.svc_time, &f->dns.svc_time);
+ break;
default:
- debug(49,5)("get_median_val: unknown type.\n");
- x=0;
+ debug(49, 5) ("get_median_val: unknown type.\n");
+ x = 0;
}
- return (int)x;
+ return (int) x;
}
static void
statLogHistDump(StoreEntry * sentry, StatLogHist * H)
#include "Packer.h"
#include "HttpReply.h"
-# if 0 /* tmp moved to HttpReply.h */
+#if 0 /* tmp moved to HttpReply.h */
#define Const const
struct _http_reply {
double version;
int code;
int content_length;
- int hdr_sz; /* includes _stored_ status-line, headers, and <CRLF> */
+ int hdr_sz; /* includes _stored_ status-line, headers, and <CRLF> */
/* Note: fields below may not match info stored on disk */
Const int cache_control;
Const int misc_headers;
Const time_t expires;
Const time_t last_modified;
Const char content_type[HTTP_REPLY_FIELD_SZ];
-#if 0 /* unused 512 bytes? */
+#if 0 /* unused 512 bytes? */
Const char user_agent[HTTP_REPLY_FIELD_SZ << 2];
#endif
};
+
#endif
struct _HierarchyLogEntry {
hier_code code;
char host[SQUIDHOSTNAMELEN];
- struct _icp_ping_data icp;
+ icp_ping_data icp;
};
struct _AccessLogEntry {
u_num32 shostid; /* sender host id */
};
-#if 0 /* this struct is not used */
+#if 0 /* this struct is not used */
struct _Stack {
void **base;
void **top;
int stack_size;
};
+
#endif
struct _Meta_data {
kb_t kbytes_in;
kb_t kbytes_out;
kb_t hit_kbytes_out;
- StatLogHist svc_time;
+ StatLogHist miss_svc_time;
+ StatLogHist nm_svc_time;
+ StatLogHist hit_svc_time;
+ StatLogHist all_svc_time;
} client_http;
struct {
int requests;
int hits_recv;
kb_t kbytes_sent;
kb_t kbytes_recv;
- StatLogHist svc_time;
+ StatLogHist query_svc_time;
+ StatLogHist reply_svc_time;
} icp;
struct {
int requests;
/*
- * $Id: tunnel.cc,v 1.73 1998/01/12 04:30:11 wessels Exp $
+ * $Id: tunnel.cc,v 1.74 1998/02/24 21:17:07 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
SslStateData *sslState = data;
int len;
len = read(sslState->server.fd, sslState->server.buf, SQUID_TCP_SO_RCVBUF);
- fd_bytes(sslState->server.fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(sslState->server.fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(26, 5) ("sslReadServer FD %d, read %d bytes\n", fd, len);
if (len < 0) {
debug(50, 1) ("sslReadServer: FD %d: read failure: %s\n",
SslStateData *sslState = data;
int len;
len = read(sslState->client.fd, sslState->client.buf, SQUID_TCP_SO_RCVBUF);
- fd_bytes(sslState->client.fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(sslState->client.fd, len, FD_READ);
+ kb_incr(&Counter.client_http.kbytes_in, len);
+ }
debug(26, 5) ("sslReadClient FD %d, read %d bytes\n",
sslState->client.fd, len);
if (len < 0) {
len = write(sslState->server.fd,
sslState->client.buf + sslState->client.offset,
sslState->client.len - sslState->client.offset);
- fd_bytes(fd, len, FD_WRITE);
+ if (len > 0) {
+ fd_bytes(sslState->server.fd, len, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, len);
+ }
debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
if (ignoreErrno(errno)) {
len = write(sslState->client.fd,
sslState->server.buf + sslState->server.offset,
sslState->server.len - sslState->server.offset);
- fd_bytes(fd, len, FD_WRITE);
+ if (len > 0) {
+ fd_bytes(sslState->client.fd, len, FD_WRITE);
+ kb_incr(&Counter.client_http.kbytes_out, len);
+ }
debug(26, 5) ("sslWriteClient FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
if (ignoreErrno(errno)) {
/*
- * $Id: wais.cc,v 1.100 1998/01/12 04:30:17 wessels Exp $
+ * $Id: wais.cc,v 1.101 1998/02/24 21:17:09 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
clen = entry->mem_obj->inmem_hi;
off = storeLowestMemReaderOffset(entry);
len = read(fd, buf, 4096);
- fd_bytes(fd, len, FD_READ);
+ if (len > 0) {
+ fd_bytes(fd, len, FD_READ);
+ kb_incr(&Counter.server.kbytes_in, len);
+ }
debug(24, 5) ("waisReadReply: FD %d read len:%d\n", fd, len);
if (len > 0) {
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
StoreEntry *entry = waisState->entry;
debug(24, 5) ("waisSendComplete: FD %d size: %d errflag: %d\n",
fd, size, errflag);
+ if (size > 0) {
+ fd_bytes(fd, size, FD_WRITE);
+ kb_incr(&Counter.server.kbytes_out, size);
+ }
if (errflag == COMM_ERR_CLOSING)
return;
if (errflag) {