Lincon Dale. Also removed some '#if 0' code chunks.
/*
- * $Id: ftp.cc,v 1.199 1998/03/03 00:31:05 rousskov Exp $
+ * $Id: ftp.cc,v 1.200 1998/03/04 23:52:39 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
static PF ftpTimeout;
static PF ftpReadControlReply;
static CWCB ftpWriteCommandCallback;
-#if 0
-static char *ftpGetBasicAuth(const char *);
-#endif
static void ftpLoginParser(const char *, FtpStateData *);
static wordlist *ftpParseControlReply(char *buf, size_t len, int *code);
static void ftpAppendSuccessHeader(FtpStateData * ftpState);
-#if 0
-static char *ftpAuthRequired(const request_t *, const char *);
-#else
static void ftpAuthRequired(HttpReply * reply, request_t * request, const char *realm);
-#endif
static STABH ftpAbort;
static void ftpHackShortcut(FtpStateData * ftpState, FTPSM * nextState);
ftpState->data.size - ftpState->data.offset);
if (len > 0) {
fd_bytes(fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.ftp.kbytes_in, len);
}
debug(9, 5) ("ftpDataRead: FD %d, Read %d bytes\n", fd, len);
if (len > 0) {
}
}
-#if 0 /* moved to mime.c because cachemgr needs it too */
-static char *
-ftpGetBasicAuth(const char *req_hdr)
-{
- char *auth_hdr;
- char *t;
- if (req_hdr == NULL)
- return NULL;
- if ((auth_hdr = mime_get_header(req_hdr, "Authorization")) == NULL)
- return NULL;
- if ((t = strtok(auth_hdr, " \t")) == NULL)
- return NULL;
- if (strcasecmp(t, "Basic") != 0)
- return NULL;
- if ((t = strtok(NULL, " \t")) == NULL)
- return NULL;
- return base64_decode(t);
-}
-#endif
-
/*
* ftpCheckAuth
*
LOCAL_ARRAY(char, realm, 8192);
const char *url = storeUrl(entry);
FtpStateData *ftpState = xcalloc(1, sizeof(FtpStateData));
-#if 0
- char *response;
-#endif
int fd;
ErrorState *err;
+ HttpReply *reply;
cbdataAdd(ftpState, MEM_NONE);
debug(9, 3) ("FtpStart: '%s'\n", url);
+ Counter.server.all.requests++;
+ Counter.server.ftp.requests++;
storeLockObject(entry);
ftpState->entry = entry;
ftpState->request = requestLink(request);
snprintf(realm, 8192, "ftp %s port %d",
ftpState->user, request->port);
}
-#if 0
- response = ftpAuthRequired(request, realm);
- storeAppend(entry, response, strlen(response));
- httpParseReplyHeaders(response, entry->mem_obj->reply);
-#else
/* create reply */
- {
- HttpReply *reply = entry->mem_obj->reply;
- assert(reply);
- /* create appropreate reply */
- ftpAuthRequired(reply, request, realm);
- httpReplySwapOut(reply, entry);
- }
-#endif
+ reply = entry->mem_obj->reply;
+ assert(reply != NULL);
+ /* create appropriate reply */
+ ftpAuthRequired(reply, request, realm);
+ httpReplySwapOut(reply, entry);
storeComplete(entry);
ftpStateFree(-1, ftpState);
return;
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);
+ kb_incr(&Counter.server.all.kbytes_out, size);
+ kb_incr(&Counter.server.ftp.kbytes_out, size);
}
if (errflag == COMM_ERR_CLOSING)
return;
ftpState->ctrl.size - ftpState->ctrl.offset);
if (len > 0) {
fd_bytes(fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.ftp.kbytes_in,len);
}
debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, len);
if (len < 0) {
}
}
storeBuffer(e);
-#if 0 /* old code */
- storeAppendPrintf(e, "HTTP/1.0 200 Gatewaying\r\n");
- reply->code = 200;
- reply->version = 1.0;
- storeAppendPrintf(e, "Date: %s\r\n", mkrfc1123(squid_curtime));
- reply->date = squid_curtime;
- storeAppendPrintf(e, "MIME-Version: 1.0\r\n");
- storeAppendPrintf(e, "Server: Squid %s\r\n", version_string);
- if (ftpState->size > 0) {
- storeAppendPrintf(e, "Content-Length: %d\r\n", ftpState->size);
- reply->content_length = ftpState->size;
- }
- if (mime_type) {
- storeAppendPrintf(e, "Content-Type: %s\r\n", mime_type);
- xstrncpy(reply->content_type, mime_type, HTTP_REPLY_FIELD_SZ);
- }
- if (mime_enc)
- storeAppendPrintf(e, "Content-Encoding: %s\r\n", mime_enc);
- if (ftpState->mdtm > 0) {
- storeAppendPrintf(e, "Last-Modified: %s\r\n", mkrfc1123(ftpState->mdtm));
- reply->last_modified = ftpState->mdtm;
- }
- storeAppendPrintf(e, "\r\n");
-#else
httpReplyReset(reply);
/* set standard stuff */
httpReplySetHeaders(reply, 1.0, HTTP_OK, "Gatewaying",
if (mime_enc)
httpHeaderSetStr(&reply->hdr, HDR_CONTENT_ENCODING, mime_enc);
httpReplySwapOut(reply, e);
-#endif
storeBufferFlush(e);
reply->hdr_sz = e->mem_obj->inmem_hi;
storeTimestampsSet(e);
comm_close(ftpState->ctrl.fd);
}
-#if 0 /* use new interfaces instead */
-static char *
-ftpAuthRequired(const request_t * request, const char *realm)
-{
- LOCAL_ARRAY(char, content, AUTH_MSG_SZ);
- LOCAL_ARRAY(char, buf, AUTH_MSG_SZ);
- char *hdr;
- int s = AUTH_MSG_SZ;
- int l = 0;
- /* Generate the reply body */
- l += snprintf(content + l, s - l,
- "<HTML><HEAD><TITLE>Authorization needed</TITLE>\n"
- "</HEAD><BODY><H1>Authorization needed</H1>\n"
- "<P>Sorry, you have to authorize yourself to request:\n"
- "<PRE> ftp://%s@%s%256.256s</PRE>\n"
- "<P>from this cache. Please check with the\n"
- "<A HREF=\"mailto:%s\">cache administrator</A>\n"
- "if you believe this is incorrect.\n"
- "<P>\n"
- "%s\n"
- "<HR>\n"
- "<ADDRESS>\n"
- "Generated by %s/%s@%s\n"
- "</ADDRESS></BODY></HTML>\n"
- "\n",
- request->login,
- request->host,
- request->urlpath,
- Config.adminEmail,
- Config.errHtmlText,
- appname,
- version_string,
- getMyHostname());
- /* Now generate reply headers with correct content length */
- hdr = httpReplyHeader(1.0, HTTP_UNAUTHORIZED,
- "text/html",
- strlen(content),
- squid_curtime,
- squid_curtime + Config.negativeTtl);
- /* Now stuff them together and add Authenticate header */
- l = 0;
- s = AUTH_MSG_SZ;
- l += snprintf(buf + l, s - l, "%s", hdr);
- l += snprintf(buf + l, s - l,
- "WWW-Authenticate: Basic realm=\"%s\"\r\n",
- realm);
- l += snprintf(buf + l, s - l, "\r\n%s", content);
- return buf;
-}
-#endif
-
static void
ftpAuthRequired(HttpReply * old_reply, request_t * request, const char *realm)
{
/*
- * $Id: gopher.cc,v 1.120 1998/03/03 00:31:06 rousskov Exp $
+ * $Id: gopher.cc,v 1.121 1998/03/04 23:52:41 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
len = read(fd, buf, TEMP_BUF_SIZE - 1);
if (len > 0) {
fd_bytes(fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.other.kbytes_in, len);
}
debug(10, 5) ("gopherReadReply: FD %d read len=%d\n", fd, len);
if (len > 0) {
fd, size, errflag);
if (size > 0) {
fd_bytes(fd, size, FD_WRITE);
- kb_incr(&Counter.server.kbytes_out, size);
+ kb_incr(&Counter.server.all.kbytes_out, size);
+ kb_incr(&Counter.server.other.kbytes_out, size);
}
if (errflag) {
ErrorState *err;
storeLockObject(entry);
gopherState->entry = entry;
debug(10, 3) ("gopherStart: %s\n", storeUrl(entry));
+ Counter.server.all.requests++;
+ Counter.server.other.requests++;
/* Parse url. */
if (gopher_url_parser(storeUrl(entry), gopherState->host, &gopherState->port,
&gopherState->type_id, gopherState->request)) {
/*
- * $Id: http.cc,v 1.243 1998/03/03 00:31:07 rousskov Exp $
+ * $Id: http.cc,v 1.244 1998/03/04 23:52:40 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
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);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.http.kbytes_in, len);
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
IOStats.Http.reads++;
for (clen = len - 1, bin = 0; clen; bin++)
fd, size, errflag);
if (size > 0) {
fd_bytes(fd, size, FD_WRITE);
- kb_incr(&Counter.server.kbytes_out, size);
+ kb_incr(&Counter.server.all.kbytes_out, size);
+ kb_incr(&Counter.server.http.kbytes_out, size);
}
if (errflag == COMM_ERR_CLOSING)
return;
int fd;
debug(11, 3) ("httpStart: \"%s %s\"\n",
RequestMethodStr[request->method], storeUrl(entry));
+ Counter.server.all.requests++;
+ Counter.server.http.requests++;
if (e) {
if (e->options & NEIGHBOR_PROXY_ONLY)
storeReleaseRequest(entry);
/*
- * $Id: ssl.cc,v 1.74 1998/02/24 21:17:07 wessels Exp $
+ * $Id: ssl.cc,v 1.75 1998/03/04 23:52:42 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
len = read(sslState->server.fd, sslState->server.buf, SQUID_TCP_SO_RCVBUF);
if (len > 0) {
fd_bytes(sslState->server.fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.other.kbytes_in, len);
}
debug(26, 5) ("sslReadServer FD %d, read %d bytes\n", fd, len);
if (len < 0) {
sslState->client.len - sslState->client.offset);
if (len > 0) {
fd_bytes(sslState->server.fd, len, FD_WRITE);
- kb_incr(&Counter.server.kbytes_out, len);
+ kb_incr(&Counter.server.all.kbytes_out, len);
+ kb_incr(&Counter.server.other.kbytes_out, len);
}
debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
ErrorState *err = NULL;
debug(26, 3) ("sslStart: '%s %s'\n",
RequestMethodStr[request->method], url);
+ Counter.server.all.requests++;
+ Counter.server.other.requests++;
/* Create socket. */
sock = comm_open(SOCK_STREAM,
0,
/*
- * $Id: stat.cc,v 1.210 1998/02/26 18:00:53 wessels Exp $
+ * $Id: stat.cc,v 1.211 1998/03/04 23:52:37 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
static const char *describeFlags(const StoreEntry *);
static const char *describeTimestamps(const StoreEntry *);
static void statAvgTick(void *notused);
-static void statAvgDump(StoreEntry *, int minutes);
+static void statAvgDump(StoreEntry *, int minutes, int hours);
static void statCountersInit(StatCounters *);
static void statCountersInitSpecial(StatCounters *);
static void statCountersClean(StatCounters *);
static void info_get_mallstat(int, int, StoreEntry *);
#endif
-/*
- * An hour's worth, plus the 'current' counter
- */
-#if 0 /* moved to defines.h to get from snmp_oidlist.c */
-#define N_COUNT_HIST 61
-#endif
StatCounters CountHist[N_COUNT_HIST];
static int NCountHist = 0;
+static StatCounters CountHourHist[N_COUNT_HOUR_HIST];
+static int NCountHourHist = 0;
+
+void
+stat_utilization_get(StoreEntry * e)
+{
+ storeAppendPrintf(e, "Cache Utilisation:\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last 5 minutes:\n");
+ if (NCountHist >= 5)
+ statAvgDump(e, 5, 0);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last 15 minutes:\n");
+ if (NCountHist >= 15)
+ statAvgDump(e, 15, 0);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last hour:\n");
+ if (NCountHist >= 60)
+ statAvgDump(e, 60, 0);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last 8 hours:\n");
+ if (NCountHourHist >= 8)
+ statAvgDump(e, 0, 8);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last day:\n");
+ if (NCountHourHist >= 24)
+ statAvgDump(e, 0, 24);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Last 3 days:\n");
+ if (NCountHourHist >= 72)
+ statAvgDump(e, 0, 72);
+ else
+ storeAppendPrintf(e, "(no values recorded yet)\n");
+ storeAppendPrintf(e, "\n");
+ storeAppendPrintf(e, "Totals since cache startup:\n");
+ statCountersDump(e);
+}
void
stat_io_get(StoreEntry * sentry)
#define XAVG(X) (dt ? (double) (f->X - l->X) / dt : 0.0)
static void
-statAvgDump(StoreEntry * sentry, int minutes)
+statAvgDump(StoreEntry * sentry, int minutes, int hours)
{
StatCounters *f;
StatCounters *l;
double ct;
double x;
assert(N_COUNT_HIST > 1);
- assert(minutes > 0);
+ assert(minutes > 0 || hours > 0);
f = &CountHist[0];
- if (minutes > N_COUNT_HIST - 1)
- minutes = N_COUNT_HIST - 1;
- l = &CountHist[minutes];
+ l = f;
+ if (minutes > 0 && hours == 0) {
+ /* checking minute readings ... */
+ if (minutes > N_COUNT_HIST - 1)
+ minutes = N_COUNT_HIST - 1;
+ l = &CountHist[minutes];
+ } else if (minutes == 0 && hours > 0) {
+ /* checking hour readings ... */
+ if (hours > N_COUNT_HOUR_HIST - 1)
+ hours = N_COUNT_HOUR_HIST - 1;
+ l = &CountHourHist[hours];
+ } else {
+ debug(18,1)("statAvgDump: Invalid args, minutes=%d, hours=%d\n",
+ minutes, hours);
+ return;
+ }
dt = tvSubDsec(l->timestamp, f->timestamp);
ct = f->cputime - l->cputime;
+ storeAppendPrintf(sentry, "sample_start_time = %d.%d (%s)\n",
+ f->timestamp.tv_sec,
+ f->timestamp.tv_usec,
+ mkrfc1123(f->timestamp.tv_sec));
+ storeAppendPrintf(sentry, "sample_end_time = %d.%d (%s)\n",
+ l->timestamp.tv_sec,
+ l->timestamp.tv_usec,
+ mkrfc1123(l->timestamp.tv_sec));
+
storeAppendPrintf(sentry, "client_http.requests = %f/sec\n",
XAVG(client_http.requests));
storeAppendPrintf(sentry, "client_http.hits = %f/sec\n",
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, "server.all.requests = %f/sec\n",
+ XAVG(server.all.requests));
+ storeAppendPrintf(sentry, "server.all.errors = %f/sec\n",
+ XAVG(server.all.errors));
+ storeAppendPrintf(sentry, "server.all.kbytes_in = %f/sec\n",
+ XAVG(server.all.kbytes_in.kb));
+ storeAppendPrintf(sentry, "server.all.kbytes_out = %f/sec\n",
+ XAVG(server.all.kbytes_out.kb));
+
+ storeAppendPrintf(sentry, "server.http.requests = %f/sec\n",
+ XAVG(server.http.requests));
+ storeAppendPrintf(sentry, "server.http.errors = %f/sec\n",
+ XAVG(server.http.errors));
+ storeAppendPrintf(sentry, "server.http.kbytes_in = %f/sec\n",
+ XAVG(server.http.kbytes_in.kb));
+ storeAppendPrintf(sentry, "server.http.kbytes_out = %f/sec\n",
+ XAVG(server.http.kbytes_out.kb));
+
+ storeAppendPrintf(sentry, "server.ftp.requests = %f/sec\n",
+ XAVG(server.ftp.requests));
+ storeAppendPrintf(sentry, "server.ftp.errors = %f/sec\n",
+ XAVG(server.ftp.errors));
+ storeAppendPrintf(sentry, "server.ftp.kbytes_in = %f/sec\n",
+ XAVG(server.ftp.kbytes_in.kb));
+ storeAppendPrintf(sentry, "server.ftp.kbytes_out = %f/sec\n",
+ XAVG(server.ftp.kbytes_out.kb));
+
+ storeAppendPrintf(sentry, "server.other.requests = %f/sec\n",
+ XAVG(server.other.requests));
+ storeAppendPrintf(sentry, "server.other.errors = %f/sec\n",
+ XAVG(server.other.errors));
+ storeAppendPrintf(sentry, "server.other.kbytes_in = %f/sec\n",
+ XAVG(server.other.kbytes_in.kb));
+ storeAppendPrintf(sentry, "server.other.kbytes_out = %f/sec\n",
+ XAVG(server.other.kbytes_out.kb));
storeAppendPrintf(sentry, "icp.pkts_sent = %f/sec\n",
XAVG(icp.pkts_sent));
{
int i;
debug(18, 5) ("statInit: Initializing...\n");
-#if 0 /* we do it in statCountersInit */
- memset(CountHist, '\0', N_COUNT_HIST * sizeof(StatCounters));
-#endif
for (i = 0; i < N_COUNT_HIST; i++)
statCountersInit(&CountHist[i]);
+ for (i = 0; i < N_COUNT_HOUR_HIST; i++)
+ statCountersInit(&CountHourHist[i]);
statCountersInit(&Counter);
- eventAdd("statAvgTick", statAvgTick, NULL, 60);
+ eventAdd("statAvgTick", statAvgTick, NULL, COUNT_INTERVAL);
cachemgrRegister("info",
"General Runtime Information",
info_get, 0);
StatCounters *p = &CountHist[1];
StatCounters *c = &Counter;
struct rusage rusage;
- eventAdd("statAvgTick", statAvgTick, NULL, 60);
+ eventAdd("statAvgTick", statAvgTick, NULL, COUNT_INTERVAL);
squid_getrusage(&rusage);
c->page_faults = rusage_pagefaults(&rusage);
c->cputime = rusage_cputime(&rusage);
/* even if NCountHist is small, we already Init()ed the tail */
statCountersClean(CountHist + N_COUNT_HIST - 1);
xmemmove(p, t, (N_COUNT_HIST - 1) * sizeof(StatCounters));
-#if 0
- memcpy(t, c, sizeof(StatCounters));
-#endif
statCountersCopy(t, c);
NCountHist++;
+
+ if ((NCountHist % COUNT_INTERVAL) == 0) {
+ /* we have an hours worth of readings. store previous hour */
+ StatCounters *p = &CountHourHist[0];
+ StatCounters *t = &CountHourHist[1];
+ StatCounters *c = &CountHist[N_COUNT_HIST];
+ xmemmove(p, t, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
+ memcpy(t, c, sizeof(StatCounters));
+ NCountHourHist++;
+ }
}
static void
assert(C);
memset(C, 0, sizeof(*C));
C->timestamp = current_time;
-
statCountersInitSpecial(C);
}
f->page_faults = rusage_pagefaults(&rusage);
f->cputime = rusage_cputime(&rusage);
+ storeAppendPrintf(sentry, "sample_time = %d.%d (%s)\n",
+ f->timestamp.tv_sec,
+ f->timestamp.tv_usec,
+ mkrfc1123(f->timestamp.tv_sec));
storeAppendPrintf(sentry, "client_http.requests = %d\n",
f->client_http.requests);
storeAppendPrintf(sentry, "client_http.hits = %d\n",
storeAppendPrintf(sentry, "client_http.hit_svc_time histogram:\n");
statHistDump(&f->client_http.hit_svc_time, sentry, NULL);
- 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, "server.all.requests = %d\n",
+ (int) f->server.all.requests);
+ storeAppendPrintf(sentry, "server.all.errors = %d\n",
+ (int) f->server.all.errors);
+ storeAppendPrintf(sentry, "server.all.kbytes_in = %d\n",
+ (int) f->server.all.kbytes_in.kb);
+ storeAppendPrintf(sentry, "server.all.kbytes_out = %d\n",
+ (int) f->server.all.kbytes_out.kb);
+
+ storeAppendPrintf(sentry, "server.http.requests = %d\n",
+ (int) f->server.http.requests);
+ storeAppendPrintf(sentry, "server.http.errors = %d\n",
+ (int) f->server.http.errors);
+ storeAppendPrintf(sentry, "server.http.kbytes_in = %d\n",
+ (int) f->server.http.kbytes_in.kb);
+ storeAppendPrintf(sentry, "server.http.kbytes_out = %d\n",
+ (int) f->server.http.kbytes_out.kb);
+
+ storeAppendPrintf(sentry, "server.ftp.requests = %d\n",
+ (int) f->server.ftp.requests);
+ storeAppendPrintf(sentry, "server.ftp.errors = %d\n",
+ (int) f->server.ftp.errors);
+ storeAppendPrintf(sentry, "server.ftp.kbytes_in = %d\n",
+ (int) f->server.ftp.kbytes_in.kb);
+ storeAppendPrintf(sentry, "server.ftp.kbytes_out = %d\n",
+ (int) f->server.ftp.kbytes_out.kb);
+
+ storeAppendPrintf(sentry, "server.other.requests = %d\n",
+ (int) f->server.other.requests);
+ storeAppendPrintf(sentry, "server.other.errors = %d\n",
+ (int) f->server.other.errors);
+ storeAppendPrintf(sentry, "server.other.kbytes_in = %d\n",
+ (int) f->server.other.kbytes_in.kb);
+ storeAppendPrintf(sentry, "server.other.kbytes_out = %d\n",
+ (int) f->server.other.kbytes_out.kb);
storeAppendPrintf(sentry, "icp.pkts_sent = %d\n",
f->icp.pkts_sent);
void
statAvg5min(StoreEntry * e)
{
- statAvgDump(e, 5);
+ statAvgDump(e, 5, 0);
}
void
statAvg60min(StoreEntry * e)
{
- statAvgDump(e, 60);
+ statAvgDump(e, 60, 0);
}
StatHist all_svc_time;
} client_http;
struct {
- int requests;
- int errors;
- kb_t kbytes_in;
- kb_t kbytes_out;
+ struct {
+ int requests;
+ int errors;
+ kb_t kbytes_in;
+ kb_t kbytes_out;
+ } all,http,ftp,other;
} server;
struct {
int pkts_sent;
/*
- * $Id: tunnel.cc,v 1.74 1998/02/24 21:17:07 wessels Exp $
+ * $Id: tunnel.cc,v 1.75 1998/03/04 23:52:42 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
len = read(sslState->server.fd, sslState->server.buf, SQUID_TCP_SO_RCVBUF);
if (len > 0) {
fd_bytes(sslState->server.fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.other.kbytes_in, len);
}
debug(26, 5) ("sslReadServer FD %d, read %d bytes\n", fd, len);
if (len < 0) {
sslState->client.len - sslState->client.offset);
if (len > 0) {
fd_bytes(sslState->server.fd, len, FD_WRITE);
- kb_incr(&Counter.server.kbytes_out, len);
+ kb_incr(&Counter.server.all.kbytes_out, len);
+ kb_incr(&Counter.server.other.kbytes_out, len);
}
debug(26, 5) ("sslWriteServer FD %d, wrote %d bytes\n", fd, len);
if (len < 0) {
ErrorState *err = NULL;
debug(26, 3) ("sslStart: '%s %s'\n",
RequestMethodStr[request->method], url);
+ Counter.server.all.requests++;
+ Counter.server.other.requests++;
/* Create socket. */
sock = comm_open(SOCK_STREAM,
0,
/*
- * $Id: wais.cc,v 1.101 1998/02/24 21:17:09 wessels Exp $
+ * $Id: wais.cc,v 1.102 1998/03/04 23:52:41 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
len = read(fd, buf, 4096);
if (len > 0) {
fd_bytes(fd, len, FD_READ);
- kb_incr(&Counter.server.kbytes_in, len);
+ kb_incr(&Counter.server.all.kbytes_in, len);
+ kb_incr(&Counter.server.other.kbytes_in, len);
}
debug(24, 5) ("waisReadReply: FD %d read len:%d\n", fd, len);
if (len > 0) {
fd, size, errflag);
if (size > 0) {
fd_bytes(fd, size, FD_WRITE);
- kb_incr(&Counter.server.kbytes_out, size);
+ kb_incr(&Counter.server.all.kbytes_out, size);
+ kb_incr(&Counter.server.other.kbytes_out, size);
}
if (errflag == COMM_ERR_CLOSING)
return;
const char *url = storeUrl(entry);
method_t method = request->method;
debug(24, 3) ("waisStart: \"%s %s\"\n", RequestMethodStr[method], url);
+ Counter.server.all.requests++;
+ Counter.server.other.requests++;
if (!Config.Wais.relayHost) {
ErrorState *err;
debug(24, 0) ("waisStart: Failed because no relay host defined!\n");