From: wessels <> Date: Sat, 5 Sep 1998 05:04:38 +0000 (+0000) Subject: syscall counters, mostly I/O X-Git-Tag: SQUID_3_0_PRE1~2763 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=886f27853e0356b2a21bc9b3dd208177372a8624;p=thirdparty%2Fsquid.git syscall counters, mostly I/O --- diff --git a/src/authenticate.cc b/src/authenticate.cc index 99fa55d6e2..28c3419db3 100644 --- a/src/authenticate.cc +++ b/src/authenticate.cc @@ -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); diff --git a/src/client_side.cc b/src/client_side.cc index e0fa870087..26f870e6c7 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); diff --git a/src/comm.cc b/src/comm.cc index 8ed96164b7..13cb322060 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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 */ diff --git a/src/comm_select.cc b/src/comm_select.cc index 0d9b3b6646..f0d34c23a0 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -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); diff --git a/src/disk.cc b/src/disk.cc index 237dc7358c..5a0c5fbe2a 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -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" @@ -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); diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 5f1c379036..17f3dc3e97 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -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); diff --git a/src/ftp.cc b/src/ftp.cc index 57c8ac56a4..752fb91758 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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); diff --git a/src/gopher.cc b/src/gopher.cc index cca17d195c..632b029278 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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); diff --git a/src/htcp.cc b/src/htcp.cc index 38c3a9ff50..bb96c0e44e 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -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); } diff --git a/src/http.cc b/src/http.cc index 5fb413748b..eeeb74f808 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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) { diff --git a/src/icmp.cc b/src/icmp.cc index 453ed5c565..d6d50a391e 100644 --- a/src/icmp.cc +++ b/src/icmp.cc @@ -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), diff --git a/src/icp_v2.cc b/src/icp_v2.cc index bb57e95d21..1a1ca93d07 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -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, diff --git a/src/ident.cc b/src/ident.cc index 8a8b361600..3145313a79 100644 --- a/src/ident.cc +++ b/src/ident.cc @@ -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) { diff --git a/src/ipcache.cc b/src/ipcache.cc index 7749b508f6..e7ac8d1c06 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -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); diff --git a/src/pconn.cc b/src/pconn.cc index 721fa6f49c..f56d1b6d26 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -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); diff --git a/src/redirect.cc b/src/redirect.cc index 8746eda163..10a9c315de 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -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); diff --git a/src/snmp_core.cc b/src/snmp_core.cc index ff19966d01..865ab8bf49 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -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, diff --git a/src/ssl.cc b/src/ssl.cc index 1283c72516..a2626d4942 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -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); diff --git a/src/stat.cc b/src/stat.cc index 67e62a7c79..935507a822 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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)); diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index 9e20fc5265..44162db744 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -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()); diff --git a/src/structs.h b/src/structs.h index 03b007ca21..5b818170c2 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 diff --git a/src/tunnel.cc b/src/tunnel.cc index 7e9d3bbfda..e364607f8b 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -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); diff --git a/src/wais.cc b/src/wais.cc index ef540f8729..26ec837618 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -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); diff --git a/src/whois.cc b/src/whois.cc index 8288679e46..de8093b4fe 100644 --- a/src/whois.cc +++ b/src/whois.cc @@ -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);