]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
syscall counters, mostly I/O
authorwessels <>
Sat, 5 Sep 1998 05:04:38 +0000 (05:04 +0000)
committerwessels <>
Sat, 5 Sep 1998 05:04:38 +0000 (05:04 +0000)
24 files changed:
src/authenticate.cc
src/client_side.cc
src/comm.cc
src/comm_select.cc
src/disk.cc
src/fqdncache.cc
src/ftp.cc
src/gopher.cc
src/htcp.cc
src/http.cc
src/icmp.cc
src/icp_v2.cc
src/ident.cc
src/ipcache.cc
src/pconn.cc
src/redirect.cc
src/snmp_core.cc
src/ssl.cc
src/stat.cc
src/store_rebuild.cc
src/structs.h
src/tunnel.cc
src/wais.cc
src/whois.cc

index 99fa55d6e2898e55746cd5ee7f3908a3f31703fe..28c3419db338c8361c4cba7f6bbe31ecbdb74301 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.cc,v 1.2 1998/08/20 22:29:54 wessels Exp $
+ * $Id: authenticate.cc,v 1.3 1998/09/04 23:04:38 wessels Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -90,6 +90,7 @@ authenticateHandleRead(int fd, void *data)
     char *t = NULL;
     int n;
 
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        authenticator->inbuf + authenticator->offset,
        authenticator->size - authenticator->offset);
index e0fa8700878bbab9900395fa252065243772eb52..26f870e6c7dd7de0272c72fd93e1200e0e409518 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.390 1998/08/30 05:21:39 wessels Exp $
+ * $Id: client_side.cc,v 1.391 1998/09/04 23:04:39 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1947,6 +1947,7 @@ clientReadRequest(int fd, void *data)
     fde *F = &fd_table[fd];
     int len = conn->in.size - conn->in.offset - 1;
     debug(33, 4) ("clientReadRequest: FD %d: reading request...\n", fd);
+    Counter.syscalls.sock.reads++;
     size = read(fd, conn->in.buf + conn->in.offset, len);
     if (size > 0) {
        fd_bytes(fd, size, FD_READ);
index 8ed96164b708dea806825892f7199506419e069f..13cb3220602f23605550de3f41d8f24b54eae5be 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: comm.cc,v 1.284 1998/08/18 22:42:17 wessels Exp $
+ * $Id: comm.cc,v 1.285 1998/09/04 23:04:41 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -133,6 +133,7 @@ commBind(int s, struct in_addr in_addr, u_short port)
     S.sin_family = AF_INET;
     S.sin_port = htons(port);
     S.sin_addr = in_addr;
+    Counter.syscalls.sock.binds++;
     if (bind(s, (struct sockaddr *) &S, sizeof(S)) == 0)
        return COMM_OK;
     debug(50, 0) ("commBind: Cannot bind socket FD %d to %s:%d: %s\n",
@@ -158,6 +159,7 @@ comm_open(int sock_type,
     int tcp_rcv_bufsz = Config.tcpRcvBufsz;
 
     /* Create socket for accepting new connections. */
+    Counter.syscalls.sock.sockets++;
     if ((new_socket = socket(AF_INET, sock_type, proto)) < 0) {
        /* Increase the number of reserved fd's if calls to socket()
         * are failing because the open file table is full.  This
@@ -303,6 +305,7 @@ commResetFD(ConnectStateData * cs)
     int fd2;
     if (!cbdataValid(cs->data))
        return 0;
+    Counter.syscalls.sock.sockets++;
     fd2 = socket(AF_INET, SOCK_STREAM, 0);
     if (fd2 < 0) {
        debug(5, 0) ("commResetFD: socket: %s\n", xstrerror());
@@ -402,6 +405,7 @@ comm_connect_addr(int sock, const struct sockaddr_in *address)
     int x;
     assert(ntohs(address->sin_port) != 0);
     /* Establish connection. */
+    Counter.syscalls.sock.connects++;
     if (connect(sock, (struct sockaddr *) address, sizeof(struct sockaddr_in)) < 0) {
        debug(5, 9) ("connect FD %d: %s\n", sock, xstrerror());
 #ifdef _SQUID_HPUX_
@@ -460,6 +464,7 @@ comm_accept(int fd, struct sockaddr_in *peer, struct sockaddr_in *me)
     socklen_t Slen;
     fde *F = NULL;
     Slen = sizeof(P);
+    Counter.syscalls.sock.accepts++;
     if ((sock = accept(fd, (struct sockaddr *) &P, &Slen)) < 0) {
        if (ignoreErrno(errno)) {
            debug(50, 5) ("comm_accept: FD %d: %s\n", fd, xstrerror());
@@ -582,6 +587,7 @@ comm_close(int fd)
 #else
     close(fd);
 #endif
+    Counter.syscalls.sock.closes++;
 }
 
 /* Send a udp datagram to specified TO_ADDR. */
@@ -593,6 +599,7 @@ comm_udp_sendto(int fd,
     int len)
 {
     int x;
+    Counter.syscalls.sock.sendtos++;
     x = sendto(fd, buf, len, 0, (struct sockaddr *) to_addr, addr_len);
     if (x < 0) {
 #ifdef _SQUID_LINUX_
@@ -768,6 +775,7 @@ commHandleWrite(int fd, void *data)
     len = write(fd, state->buf + state->offset, nleft);
     debug(5, 5) ("commHandleWrite: write() returns %d\n", len);
     fd_bytes(fd, len, FD_WRITE);
+    Counter.syscalls.sock.writes++;
 
     if (len == 0) {
        /* Note we even call write if nleft == 0 */
index 0d9b3b6646ebc22fd00cd372e5abd8e17e534ffe..f0d34c23a0fd062c18a06a6c8c00e99dd9901c9c 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: comm_select.cc,v 1.7 1998/09/03 03:48:39 wessels Exp $
+ * $Id: comm_select.cc,v 1.8 1998/09/04 23:04:42 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -176,6 +176,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds)
 #if !ALARM_UPDATES_TIME
     getCurrentTime();
 #endif
+    Counter.syscalls.polls++;
     if (poll(pfds, npfds, 0) < 1)
        return incame;
     for (i = 0; i < npfds; i++) {
@@ -309,6 +310,7 @@ comm_poll(int msec)
        if (msec > MAX_POLL_TIME)
            msec = MAX_POLL_TIME;
        for (;;) {
+           Counter.syscalls.polls++;
            num = poll(pfds, nfds, msec);
            Counter.select_loops++;
            if (num >= 0)
@@ -440,6 +442,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds)
 #if !ALARM_UPDATES_TIME
     getCurrentTime();
 #endif
+    Counter.syscalls.selects++;
     if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1)
        return incame;
     for (i = 0; i < nfds; i++) {
@@ -573,6 +576,7 @@ comm_select(int msec)
        for (;;) {
            poll_time.tv_sec = msec / 1000;
            poll_time.tv_usec = (msec % 1000) * 1000;
+           Counter.syscalls.selects++;
            num = select(maxfd, &readfds, &writefds, NULL, &poll_time);
            Counter.select_loops++;
            if (num >= 0)
@@ -618,7 +622,7 @@ comm_select(int msec)
                    hdl = fd_table[fd].read_handler;
                    fd_table[fd].read_handler = NULL;
                    hdl(fd, fd_table[fd].read_data);
-                   Counter.select_fds++;
+                   Counter.select_fds++;
                }
                if (commCheckICPIncoming)
                    comm_select_icp_incoming();
@@ -631,7 +635,7 @@ comm_select(int msec)
                    hdl = fd_table[fd].write_handler;
                    fd_table[fd].write_handler = NULL;
                    hdl(fd, fd_table[fd].write_data);
-                   Counter.select_fds++;
+                   Counter.select_fds++;
                }
                if (commCheckICPIncoming)
                    comm_select_icp_incoming();
@@ -692,6 +696,7 @@ examine_select(fd_set * readfds, fd_set * writefds)
            FD_SET(fd, &write_x);
        else
            continue;
+       Counter.syscalls.selects++;
        num = select(Squid_MaxFD, &read_x, &write_x, NULL, &tv);
        if (num > -1) {
            debug(5, 5) ("FD %d is valid.\n", fd);
index 237dc7358c05a6d92bb4f3a83ceaf328b6dacae0..5a0c5fbe2ab7440926d2a972c532d8e81ab7d7c1 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: disk.cc,v 1.133 1998/08/24 22:06:44 wessels Exp $
+ * $Id: disk.cc,v 1.134 1998/09/04 23:04:43 wessels Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -95,7 +95,7 @@ fileOpenComplete(int unused, void *data, int fd, int errcode)
     open_ctrl_t *ctrlp = (open_ctrl_t *) data;
     debug(6, 5) ("fileOpenComplete: fd %d, data %p, errcode %d\n",
        fd, data, errcode);
-
+    Counter.syscalls.disk.opens++;
     if (fd == -2 && errcode == -2) {   /* Cancelled - clean up */
        if (ctrlp->callback)
            (ctrlp->callback) (ctrlp->callback_data, fd, errcode);
@@ -162,6 +162,7 @@ file_close(int fd)
     debug(6, F->flags.close_request ? 2 : 5)
        ("file_close: FD %d, really closing\n", fd);
     fd_close(fd);
+    Counter.syscalls.disk.closes++;
 }
 
 /*
@@ -255,6 +256,7 @@ diskHandleWriteComplete(int fd, void *data, int len, int errcode)
     int do_close;
     errno = errcode;
     debug(6, 3) ("diskHandleWriteComplete: FD %d len = %d\n", fd, len);
+    Counter.syscalls.disk.writes++;
 #if USE_ASYNC_IO
 /*
  * From:    "Michael O'Reilly" <michael@metal.iinet.net.au>
@@ -476,6 +478,7 @@ diskHandleRead(int fd, void *data)
        debug(6, 3) ("diskHandleRead: FD %d seeking to offset %d\n",
            fd, (int) ctrl_dat->offset);
        lseek(fd, ctrl_dat->offset, SEEK_SET);  /* XXX ignore return? */
+       Counter.syscalls.disk.seeks++;
        F->disk.offset = ctrl_dat->offset;
     }
     len = read(fd, ctrl_dat->buf, ctrl_dat->req_len);
@@ -493,6 +496,7 @@ diskHandleReadComplete(int fd, void *data, int len, int errcode)
 #ifdef OPTIMISTIC_IO
     fde *F = &fd_table[fd];
 #endif /* OPTIMISTIC_IO */
+    Counter.syscalls.disk.reads++;
     errno = errcode;
     if (len == -2 && errcode == -2) {  /* Read cancelled - cleanup */
        cbdataUnlock(ctrl_dat->client_data);
index 5f1c3790368fc68598cefa795a8da24d317dc654..17f3dc3e979d4bd2f2464ca52cb57371d0543a02 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: fqdncache.cc,v 1.113 1998/08/30 05:21:41 wessels Exp $
+ * $Id: fqdncache.cc,v 1.114 1998/09/04 23:04:44 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -344,6 +344,7 @@ fqdncache_dnsHandleRead(int fd, void *data)
     fqdncache_entry *f = NULL;
     fqdncache_entry *x = NULL;
 
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        dnsData->ip_inbuf + dnsData->offset,
        dnsData->size - dnsData->offset);
index 57c8ac56a4166e6be1239543a13eec4ddfa264f5..752fb91758bb15c0ca26868d7ab18dcd8abeb01a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.249 1998/08/21 19:28:57 wessels Exp $
+ * $Id: ftp.cc,v 1.250 1998/09/04 23:04:46 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -809,6 +809,7 @@ ftpDataRead(int fd, void *data)
     read_sz = delayBytesWanted(delay_id, 1, read_sz);
 #endif
     memset(ftpState->data.buf + ftpState->data.offset, '\0', read_sz);
+    Counter.syscalls.sock.reads++;
     len = read(fd, ftpState->data.buf + ftpState->data.offset, read_sz);
     if (len > 0) {
        fd_bytes(fd, len, FD_READ);
@@ -1142,6 +1143,7 @@ ftpReadControlReply(int fd, void *data)
     ErrorState *err;
     debug(9, 5) ("ftpReadControlReply\n");
     assert(ftpState->ctrl.offset < ftpState->ctrl.size);
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        ftpState->ctrl.buf + ftpState->ctrl.offset,
        ftpState->ctrl.size - ftpState->ctrl.offset);
index cca17d195cb09b523b25d580765db5365c9d20a8..632b02927831b2d621eab5ff8ef0f971f566d195 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: gopher.cc,v 1.136 1998/08/17 16:44:06 wessels Exp $
+ * $Id: gopher.cc,v 1.137 1998/09/04 23:04:47 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -612,6 +612,7 @@ gopherReadReply(int fd, void *data)
     read_sz = delayBytesWanted(delay_id, 1, read_sz);
 #endif
     /* leave one space for \0 in gopherToHTML */
+    Counter.syscalls.sock.reads++;
     len = read(fd, buf, read_sz);
     if (len > 0) {
        fd_bytes(fd, len, FD_READ);
index 38c3a9ff50ee9006db84a2ad8930f6c8758f2d9b..bb96c0e44e39737469afeb3c6dcb818b5a8e0565 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: htcp.cc,v 1.21 1998/09/01 23:32:44 wessels Exp $
+ * $Id: htcp.cc,v 1.22 1998/09/04 23:04:48 wessels Exp $
  *
  * DEBUG: section 31    Hypertext Caching Protocol
  * AUTHOR: Duane Wesssels
@@ -527,7 +527,7 @@ htcpUnpackDetail(char *buf, int sz)
 }
 
 static void
-htcpTstReply(htcpDataHeader *dhdr, StoreEntry * e, htcpSpecifier * spec, struct sockaddr_in *from)
+htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct sockaddr_in *from)
 {
     htcpStuff stuff;
     char *pkt;
@@ -558,7 +558,7 @@ htcpTstReply(htcpDataHeader *dhdr, StoreEntry * e, htcpSpecifier * spec, struct
            squid_curtime - e->timestamp : 0);
        httpHeaderPackInto(&hdr, &p);
        stuff.D.resp_hdrs = xstrdup(mb.buf);
-       debug(31,1)("htcpTstReply: resp_hdrs = {%s}\n", stuff.D.resp_hdrs);
+       debug(31, 1) ("htcpTstReply: resp_hdrs = {%s}\n", stuff.D.resp_hdrs);
        memBufReset(&mb);
        httpHeaderReset(&hdr);
        if (e->expires > -1)
@@ -567,20 +567,20 @@ htcpTstReply(htcpDataHeader *dhdr, StoreEntry * e, htcpSpecifier * spec, struct
            httpHeaderPutTime(&hdr, HDR_LAST_MODIFIED, e->lastmod);
        httpHeaderPackInto(&hdr, &p);
        stuff.D.entity_hdrs = xstrdup(mb.buf);
-       debug(31,1)("htcpTstReply: entity_hdrs = {%s}\n", stuff.D.entity_hdrs);
+       debug(31, 1) ("htcpTstReply: entity_hdrs = {%s}\n", stuff.D.entity_hdrs);
        memBufReset(&mb);
        httpHeaderReset(&hdr);
        if ((host = urlHostname(spec->uri))) {
            netdbHostData(host, &samp, &rtt, &hops);
            if (rtt || hops) {
                snprintf(cto_buf, 128, "%s %d %f %d",
-                       host, samp, 0.001 * rtt, hops);
+                   host, samp, 0.001 * rtt, hops);
                httpHeaderPutExt(&hdr, "Cache-to-Origin", cto_buf);
            }
        }
        httpHeaderPackInto(&hdr, &p);
        stuff.D.cache_hdrs = xstrdup(mb.buf);
-       debug(31,1)("htcpTstReply: cache_hdrs = {%s}\n", stuff.D.cache_hdrs);
+       debug(31, 1) ("htcpTstReply: cache_hdrs = {%s}\n", stuff.D.cache_hdrs);
        memBufClean(&mb);
        httpHeaderClean(&hdr);
        packerClean(&p);
@@ -618,13 +618,13 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
     htcpDetail *d = NULL;
     char *t;
     if (hdr->F1 == 1) {
-       debug(31,1)("htcpHandleTstResponse: error condition, F1/MO == 1\n");
+       debug(31, 1) ("htcpHandleTstResponse: error condition, F1/MO == 1\n");
        return;
     }
     memset(&htcpReply, '\0', sizeof(htcpReply));
     httpHeaderInit(&htcpReply.hdr, hoHtcpReply);
     htcpReply.msg_id = hdr->msg_id;
-    debug(31,1)("htcpHandleTstResponse: msg_id = %d\n", (int) htcpReply.msg_id);
+    debug(31, 1) ("htcpHandleTstResponse: msg_id = %d\n", (int) htcpReply.msg_id);
     htcpReply.hit = hdr->response ? 0 : 1;
     if (hdr->F1) {
        debug(31, 1) ("htcpHandleTstResponse: MISS\n");
@@ -643,14 +643,14 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
            httpHeaderParse(&htcpReply.hdr, t, t + strlen(t));
     }
     key = queried_keys[htcpReply.msg_id % N_QUERIED_KEYS];
-    debug(31,1)("htcpHandleTstResponse: key (%p) %s\n", key, storeKeyText(key));
+    debug(31, 1) ("htcpHandleTstResponse: key (%p) %s\n", key, storeKeyText(key));
     neighborsHtcpReply(key, &htcpReply, from);
     if (d)
-        htcpFreeDetail(d);
+       htcpFreeDetail(d);
 }
 
 static void
-htcpHandleTstRequest(htcpDataHeader *dhdr, char *buf, int sz, struct sockaddr_in *from)
+htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct sockaddr_in *from)
 {
     /* buf should be a SPECIFIER */
     htcpSpecifier *s;
@@ -790,6 +790,7 @@ htcpRecv(int fd, void *data)
     static struct sockaddr_in from;
     int flen = sizeof(struct sockaddr_in);
     memset(&from, '\0', flen);
+    Counter.syscalls.sock.recvfroms++;
     len = recvfrom(fd, buf, 8192, 0, (struct sockaddr *) &from, &flen);
     debug(31, 1) ("htcpRecv: FD %d, %d bytes from %s:%d\n",
        fd, len, inet_ntoa(from.sin_addr), ntohs(from.sin_port));
@@ -874,7 +875,7 @@ htcpQuery(StoreEntry * e, request_t * req, peer * p)
     htcpSend(pkt, (int) pktlen, &p->in_addr);
     save_key = queried_keys[stuff.msg_id % N_QUERIED_KEYS];
     storeKeyCopy(save_key, e->key);
-    debug(31,1)("htcpQuery: key (%p) %s\n", save_key, storeKeyText(save_key));
+    debug(31, 1) ("htcpQuery: key (%p) %s\n", save_key, storeKeyText(save_key));
     xfree(pkt);
 }
 
index 5fb413748b852e8a677848edc63a5d7f3ef70cdc..eeeb74f8089690bcb3d16c08c418744fa71a74dc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.313 1998/08/21 08:40:57 wessels Exp $
+ * $Id: http.cc,v 1.314 1998/09/04 23:04:50 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -413,6 +413,7 @@ httpReadReply(int fd, void *data)
 #if DELAY_POOLS
     read_sz = delayBytesWanted(delay_id, 1, read_sz);
 #endif
+    Counter.syscalls.sock.reads++;
     len = read(fd, buf, read_sz);
     debug(11, 5) ("httpReadReply: FD %d: len %d.\n", fd, len);
     if (len > 0) {
index 453ed5c565455e39029dd5a9ebab5f6f26fe6e53..d6d50a391e9104496648a3e581ecd4e55c8d5d82 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icmp.cc,v 1.62 1998/08/05 06:05:01 wessels Exp $
+ * $Id: icmp.cc,v 1.63 1998/09/04 23:04:51 wessels Exp $
  *
  * DEBUG: section 37    ICMP Routines
  * AUTHOR: Duane Wessels
@@ -68,6 +68,7 @@ icmpRecv(int unused1, void *unused2)
     static struct sockaddr_in F;
     commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0);
     memset(&preply, '\0', sizeof(pingerReplyData));
+    Counter.syscalls.sock.recvfroms++;
     n = recv(icmp_sock,
        (char *) &preply,
        sizeof(pingerReplyData),
index bb57e95d2181a3fc0b53fe1a7d7eeae7a1f66f3c..1a1ca93d0755f167e0451644d60d3b78af58313e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v2.cc,v 1.49 1998/08/18 19:14:02 wessels Exp $
+ * $Id: icp_v2.cc,v 1.50 1998/09/04 23:04:52 wessels Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol
  * AUTHOR: Duane Wessels
@@ -347,6 +347,7 @@ icpHandleUdp(int sock, void *data)
     while (max--) {
        from_len = sizeof(from);
        memset(&from, '\0', from_len);
+       Counter.syscalls.sock.recvfroms++;
        len = recvfrom(sock,
            buf,
            SQUID_UDP_SO_RCVBUF - 1,
index 8a8b361600d3fd7d1f99098fa3213df38dc9c475..3145313a7977d6a381b13be69478d65c49df1ca7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ident.cc,v 1.44 1998/07/22 20:37:29 wessels Exp $
+ * $Id: ident.cc,v 1.45 1998/09/04 23:04:53 wessels Exp $
  *
  * DEBUG: section 30    Ident (RFC 931)
  * AUTHOR: Duane Wessels
@@ -117,6 +117,7 @@ identReadReply(int fd, void *data)
     int len = -1;
 
     buf[0] = '\0';
+    Counter.syscalls.sock.reads++;
     len = read(fd, buf, BUFSIZ);
     fd_bytes(fd, len, FD_READ);
     if (len > 0) {
index 7749b508f6a13b4b6b20ee3133803c1a551d2ef9..e7ac8d1c06816cd8da2845a72b59e2ce31a69e87 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.199 1998/08/21 08:41:57 wessels Exp $
+ * $Id: ipcache.cc,v 1.200 1998/09/04 23:04:54 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -393,6 +393,7 @@ ipcache_dnsHandleRead(int fd, void *data)
     ipcache_entry *i = NULL;
     ipcache_entry *x = NULL;
 
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        dnsData->ip_inbuf + dnsData->offset,
        dnsData->size - dnsData->offset);
index 721fa6f49c35d3467a6b57300920cb1fa1547ad4..f56d1b6d26cafc68927d7c1cf3dd40f50105afcc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: pconn.cc,v 1.23 1998/08/14 18:02:49 wessels Exp $
+ * $Id: pconn.cc,v 1.24 1998/09/04 23:04:56 wessels Exp $
  *
  * DEBUG: section 48    Persistent Connections
  * AUTHOR: Duane Wessels
@@ -119,6 +119,7 @@ pconnRead(int fd, void *data)
     struct _pconn *p = data;
     int n;
     assert(table != NULL);
+    Counter.syscalls.sock.reads++;
     n = read(fd, buf, 256);
     debug(48, 3) ("pconnRead: %d bytes from FD %d, %s\n", n, fd, p->key);
     pconnRemoveFD(p, fd);
index 8746eda163cc5b11d255588cbf5dbba2d6caef5f..10a9c315de32d2f9a91180f640091c42046ae022 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.64 1998/07/25 00:16:29 wessels Exp $
+ * $Id: redirect.cc,v 1.65 1998/09/04 23:04:58 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -93,6 +93,7 @@ redirectHandleRead(int fd, void *data)
     char *t = NULL;
     int n;
 
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        redirector->inbuf + redirector->offset,
        redirector->size - redirector->offset);
index ff19966d01385fc0e8028f3108d6d664f4c6adc2..865ab8bf4943456ee652ef0ecffac22bda235fd8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: snmp_core.cc,v 1.9 1998/08/18 19:14:08 wessels Exp $
+ * $Id: snmp_core.cc,v 1.10 1998/09/04 23:04:59 wessels Exp $
  *
  * DEBUG: section 49    SNMP support
  * AUTHOR: Kostas Anagnostakis
@@ -132,6 +132,7 @@ snmpHandleUdp(int sock, void *not_used)
     commSetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0);
     from_len = sizeof(struct sockaddr_in);
     memset(&from, '\0', from_len);
+    Counter.syscalls.sock.recvfroms++;
     len = recvfrom(sock,
        buf,
        SNMP_REQUEST_SIZE,
index 1283c725167846a4372c8e5585d82799d46c1ad2..a2626d494204b253c3ff2a2981b44452de897f5a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ssl.cc,v 1.88 1998/08/20 22:30:01 wessels Exp $
+ * $Id: ssl.cc,v 1.89 1998/09/04 23:05:00 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -186,6 +186,7 @@ sslReadServer(int fd, void *data)
 #if DELAY_POOLS
     read_sz = delayBytesWanted(sslState->request->delay_id, 1, read_sz);
 #endif
+    Counter.syscalls.sock.reads++;
     len = read(fd, sslState->server.buf + sslState->server.len, read_sz);
     debug(26, 3) ("sslReadServer: FD %d, read   %d bytes\n", fd, len);
     if (len > 0) {
@@ -221,6 +222,7 @@ sslReadClient(int fd, void *data)
     debug(26, 3) ("sslReadClient: FD %d, reading %d bytes at offset %d\n",
        fd, SQUID_TCP_SO_RCVBUF - sslState->client.len,
        sslState->client.len);
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        sslState->client.buf + sslState->client.len,
        SQUID_TCP_SO_RCVBUF - sslState->client.len);
@@ -253,6 +255,7 @@ sslWriteServer(int fd, void *data)
     assert(fd == sslState->server.fd);
     debug(26, 3) ("sslWriteServer: FD %d, %d bytes to write\n",
        fd, sslState->client.len);
+    Counter.syscalls.sock.writes++;
     len = write(fd,
        sslState->client.buf,
        sslState->client.len);
@@ -291,6 +294,7 @@ sslWriteClient(int fd, void *data)
     assert(fd == sslState->client.fd);
     debug(26, 3) ("sslWriteClient: FD %d, %d bytes to write\n",
        fd, sslState->server.len);
+    Counter.syscalls.sock.writes++;
     len = write(fd,
        sslState->server.buf,
        sslState->server.len);
index 67e62a7c79d27c354607cb7a4c7daf58e0b9ec8d..935507a822d60c43f0066f379aa12054449a4270 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.283 1998/09/03 03:48:36 wessels Exp $
+ * $Id: stat.cc,v 1.284 1998/09/04 23:05:02 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -750,7 +750,27 @@ statAvgDump(StoreEntry * sentry, int minutes, int hours)
        : 0.0);
     x = statHistDeltaMedian(&l->select_fds_hist, &f->select_fds_hist);
     storeAppendPrintf(sentry, "median_select_fds = %f\n", x);
-       
+
+#if HAVE_POLL
+    storeAppendPrintf(sentry, "syscalls.polls = %f/sec\n", XAVG(syscalls.polls));
+#else
+    storeAppendPrintf(sentry, "syscalls.selects = %f/sec\n", XAVG(syscalls.selects));
+#endif
+    storeAppendPrintf(sentry, "syscalls.disk.opens = %f/sec\n", XAVG(syscalls.disk.opens));
+    storeAppendPrintf(sentry, "syscalls.disk.closes = %f/sec\n", XAVG(syscalls.disk.closes));
+    storeAppendPrintf(sentry, "syscalls.disk.reads = %f/sec\n", XAVG(syscalls.disk.reads));
+    storeAppendPrintf(sentry, "syscalls.disk.writes = %f/sec\n", XAVG(syscalls.disk.writes));
+    storeAppendPrintf(sentry, "syscalls.disk.seeks = %f/sec\n", XAVG(syscalls.disk.seeks));
+    storeAppendPrintf(sentry, "syscalls.sock.accepts = %f/sec\n", XAVG(syscalls.sock.accepts));
+    storeAppendPrintf(sentry, "syscalls.sock.sockets = %f/sec\n", XAVG(syscalls.sock.sockets));
+    storeAppendPrintf(sentry, "syscalls.sock.connects = %f/sec\n", XAVG(syscalls.sock.connects));
+    storeAppendPrintf(sentry, "syscalls.sock.binds = %f/sec\n", XAVG(syscalls.sock.binds));
+    storeAppendPrintf(sentry, "syscalls.sock.closes = %f/sec\n", XAVG(syscalls.sock.closes));
+    storeAppendPrintf(sentry, "syscalls.sock.reads = %f/sec\n", XAVG(syscalls.sock.reads));
+    storeAppendPrintf(sentry, "syscalls.sock.writes = %f/sec\n", XAVG(syscalls.sock.writes));
+    storeAppendPrintf(sentry, "syscalls.sock.recvfroms = %f/sec\n", XAVG(syscalls.sock.recvfroms));
+    storeAppendPrintf(sentry, "syscalls.sock.sendtos = %f/sec\n", XAVG(syscalls.sock.sendtos));
+
     storeAppendPrintf(sentry, "cpu_time = %f seconds\n", ct);
     storeAppendPrintf(sentry, "wall_time = %f seconds\n", dt);
     storeAppendPrintf(sentry, "cpu_usage = %f%%\n", dpercent(ct, dt));
index 9e20fc52653c085bfc8d0c26c55cb51cbf9e2043..44162db74418e05d483d658cf2c9b02cfb154e75 100644 (file)
@@ -1,5 +1,6 @@
+
 /*
- * $Id: store_rebuild.cc,v 1.46 1998/08/24 22:06:48 wessels Exp $
+ * $Id: store_rebuild.cc,v 1.47 1998/09/04 23:05:03 wessels Exp $
  *
  * DEBUG: section 20    Store Rebuild Routines
  * AUTHOR: Duane Wessels
@@ -143,6 +144,7 @@ storeRebuildFromDirectory(rebuild_dir * d)
            debug(20, 1) ("  %7d files opened so far.\n",
                RebuildState.statcount);
        debug(20, 9) ("file_in: fd=%d %08X\n", fd, sfileno);
+       Counter.syscalls.disk.reads++;
        if (read(fd, hdr_buf, DISK_PAGE_SIZE) < 0) {
            debug(20, 1) ("storeRebuildFromDirectory: read(FD %d): %s\n",
                fd, xstrerror());
index 03b007ca2171e722b99c81d4a4f252d10c7268f7..5b818170c23e1679a5bf3ba74fa13d975773d556 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.216 1998/09/03 03:48:37 wessels Exp $
+ * $Id: structs.h,v 1.217 1998/09/04 23:05:04 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -966,15 +966,15 @@ struct _peer {
        int logged_state;       /* so we can print dead/revived msgs */
     } stats;
     struct {
-        int version;
+       int version;
        int counts[ICP_END];
-        u_short port;
+       u_short port;
     } icp;
 #if USE_HTCP
     struct {
        double version;
        int counts[2];
-        u_short port;
+       u_short port;
     } htcp;
 #endif
     u_short http_port;
@@ -1212,7 +1212,7 @@ struct _request_flags {
     unsigned int used_proxy_auth:1;
     unsigned int redirected:1;
 #if HTTP_VIOLATIONS
-    unsigned int nocache_hack:1;               /* for changing/ignoring no-cache requests */
+    unsigned int nocache_hack:1;       /* for changing/ignoring no-cache requests */
 #endif
 };
 
@@ -1393,6 +1393,31 @@ struct _StatCounters {
     StatHist comm_icp_incoming;
     StatHist comm_http_incoming;
     StatHist select_fds_hist;
+    struct {
+       struct {
+           int opens;
+           int closes;
+           int reads;
+           int writes;
+           int seeks;
+       } disk;
+       struct {
+           int accepts;
+           int sockets;
+           int connects;
+           int binds;
+           int closes;
+           int reads;
+           int writes;
+           int recvfroms;
+           int sendtos;
+       } sock;
+#if HAVE_POLL
+       int polls;
+#else
+       int selects;
+#endif
+    } syscalls;
 };
 
 /* per header statistics */
@@ -1507,15 +1532,16 @@ struct _FwdServer {
 
 #if USE_HTCP
 struct _htcpReplyData {
-       int hit;
-       HttpHeader hdr;
-       u_num32 msg_id;
-       double version;
-       struct {
+    int hit;
+    HttpHeader hdr;
+    u_num32 msg_id;
+    double version;
+    struct {
        /* cache-to-origin */
-               double rtt;
-               int samp;
-               int hops;
-       } cto;
+       double rtt;
+       int samp;
+       int hops;
+    } cto;
 };
+
 #endif
index 7e9d3bbfdac86b9aaced5cea780b7573f4dac199..e364607f8bfe84c27bc2b49a87de2f11baab351c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.88 1998/08/20 22:30:01 wessels Exp $
+ * $Id: tunnel.cc,v 1.89 1998/09/04 23:05:00 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -186,6 +186,7 @@ sslReadServer(int fd, void *data)
 #if DELAY_POOLS
     read_sz = delayBytesWanted(sslState->request->delay_id, 1, read_sz);
 #endif
+    Counter.syscalls.sock.reads++;
     len = read(fd, sslState->server.buf + sslState->server.len, read_sz);
     debug(26, 3) ("sslReadServer: FD %d, read   %d bytes\n", fd, len);
     if (len > 0) {
@@ -221,6 +222,7 @@ sslReadClient(int fd, void *data)
     debug(26, 3) ("sslReadClient: FD %d, reading %d bytes at offset %d\n",
        fd, SQUID_TCP_SO_RCVBUF - sslState->client.len,
        sslState->client.len);
+    Counter.syscalls.sock.reads++;
     len = read(fd,
        sslState->client.buf + sslState->client.len,
        SQUID_TCP_SO_RCVBUF - sslState->client.len);
@@ -253,6 +255,7 @@ sslWriteServer(int fd, void *data)
     assert(fd == sslState->server.fd);
     debug(26, 3) ("sslWriteServer: FD %d, %d bytes to write\n",
        fd, sslState->client.len);
+    Counter.syscalls.sock.writes++;
     len = write(fd,
        sslState->client.buf,
        sslState->client.len);
@@ -291,6 +294,7 @@ sslWriteClient(int fd, void *data)
     assert(fd == sslState->client.fd);
     debug(26, 3) ("sslWriteClient: FD %d, %d bytes to write\n",
        fd, sslState->server.len);
+    Counter.syscalls.sock.writes++;
     len = write(fd,
        sslState->server.buf,
        sslState->server.len);
index ef540f8729c2b1cc87339f298c0eb975ac9ed761..26ec83761836dcb47fb89d6425886cf2ba433e72 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.117 1998/08/17 16:44:14 wessels Exp $
+ * $Id: wais.cc,v 1.118 1998/09/04 23:05:06 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -103,6 +103,7 @@ waisReadReply(int fd, void *data)
 #if DELAY_POOLS
     read_sz = delayBytesWanted(delay_id, 1, read_sz);
 #endif
+    Counter.syscalls.sock.reads++;
     len = read(fd, buf, read_sz);
     if (len > 0) {
        fd_bytes(fd, len, FD_READ);
index 8288679e46acf7b1c1d78b4e59c240d6413c133a..de8093b4fe12b24dcf91c19ee3c8e3fb1366ca14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: whois.cc,v 1.5 1998/07/22 20:38:07 wessels Exp $
+ * $Id: whois.cc,v 1.6 1998/09/04 23:05:07 wessels Exp $
  *
  * DEBUG: section 75    WHOIS protocol
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -85,6 +85,7 @@ whoisReadReply(int fd, void *data)
     StoreEntry *entry = p->entry;
     char *buf = memAllocate(MEM_4K_BUF);
     int len;
+    Counter.syscalls.sock.reads++;
     len = read(fd, buf, 4095);
     buf[len] = '\0';
     debug(75, 3) ("whoisReadReply: FD %d read %d bytes\n", fd, len);