From d239c2f5ade47ac544c9902f9e03fb51cfd1dc5b Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 3 Sep 1998 09:37:33 +0000 Subject: [PATCH] more select stats to debug poor performance --- src/comm_select.cc | 12 +++++++++++- src/protos.h | 6 +++--- src/stat.cc | 11 ++++++++--- src/structs.h | 4 +++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/comm_select.cc b/src/comm_select.cc index db2d91e1e1..474934cb82 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,7 +1,7 @@ /* - * $Id: comm_select.cc,v 1.5 1998/08/14 09:22:33 wessels Exp $ + * $Id: comm_select.cc,v 1.6 1998/09/03 03:37:33 wessels Exp $ * * DEBUG: section 5 Socket Functions * @@ -265,9 +265,11 @@ comm_poll(int msec) int callicp = 0, callhttp = 0; static time_t last_timeout = 0; double timeout = current_dtime + (msec / 1000.0); + double start; do { #if !ALARM_UPDATES_TIME getCurrentTime(); + start = current_dtime; #endif #if USE_ASYNC_IO aioCheckCallbacks(); @@ -346,6 +348,7 @@ comm_poll(int msec) if ((hdl = fd_table[fd].read_handler)) { fd_table[fd].read_handler = NULL; hdl(fd, fd_table[fd].read_data); + Counter.select_fds++; } if (commCheckICPIncoming) comm_poll_icp_incoming(); @@ -357,6 +360,7 @@ comm_poll(int msec) if ((hdl = fd_table[fd].write_handler)) { fd_table[fd].write_handler = NULL; hdl(fd, fd_table[fd].write_data); + Counter.select_fds++; } if (commCheckICPIncoming) comm_poll_icp_incoming(); @@ -393,6 +397,10 @@ comm_poll(int msec) comm_poll_icp_incoming(); if (callhttp) comm_poll_http_incoming(); +#if !ALARM_UPDATES_TIME + getCurrentTime(); + Counter.select_time += (current_dtime - start); +#endif return COMM_OK; } while (timeout > current_dtime); debug(5, 8) ("comm_poll: time out: %d.\n", squid_curtime); @@ -608,6 +616,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++; } if (commCheckICPIncoming) comm_select_icp_incoming(); @@ -620,6 +629,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++; } if (commCheckICPIncoming) comm_select_icp_incoming(); diff --git a/src/protos.h b/src/protos.h index 134bd280de..8edac3ad09 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.258 1998/08/27 06:28:58 wessels Exp $ + * $Id: protos.h,v 1.259 1998/09/03 03:37:34 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -606,7 +606,7 @@ extern void netdbBinaryExchange(StoreEntry *); extern EVH netdbExchangeStart; extern void netdbExchangeUpdatePeer(struct in_addr, peer *, double, double); extern peer *netdbClosestParent(request_t *); -void netdbHostData(const char *host, int *samp, int *rtt, int *hops); +extern void netdbHostData(const char *host, int *samp, int *rtt, int *hops); extern void cachemgrStart(int fd, request_t * request, StoreEntry * entry); extern void cachemgrRegister(const char *, const char *, OBJH *, int, int); @@ -665,7 +665,7 @@ extern double median_svc_get(int, int); extern void pconnHistCount(int, int); extern int stat5minClientRequests(void); extern double stat5minCPUUsage(void); - +extern double statMedianSvc(int, int); /* StatHist */ diff --git a/src/stat.cc b/src/stat.cc index e5efe03e46..a5562ed695 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.281 1998/08/21 16:58:12 wessels Exp $ + * $Id: stat.cc,v 1.282 1998/09/03 03:37:35 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -58,7 +58,6 @@ static void statCountersInit(StatCounters *); static void statCountersInitSpecial(StatCounters *); static void statCountersClean(StatCounters *); static void statCountersCopy(StatCounters * dest, const StatCounters * orig); -static double statMedianSvc(int, int); static void statStoreEntry(StoreEntry * s, StoreEntry * e); static double statCPUUsage(int minutes); static OBJH stat_io_get; @@ -743,6 +742,12 @@ statAvgDump(StoreEntry * sentry, int minutes, int hours) XAVG(page_faults)); storeAppendPrintf(sentry, "select_loops = %f/sec\n", XAVG(select_loops)); + storeAppendPrintf(sentry, "select_fds = %f/sec\n", + XAVG(select_fds)); + storeAppendPrintf(sentry, "average_select_fd_period = %f/fd\n", + f->select_fds > l->select_fds ? + (f->select_time - l->select_time) / (f->select_fds - l->select_fds) + : 0.0); 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)); @@ -1146,7 +1151,7 @@ statAvg60min(StoreEntry * e) statAvgDump(e, 60, 0); } -static double +double statMedianSvc(int interval, int which) { StatCounters *f; diff --git a/src/structs.h b/src/structs.h index 8972f1d15a..36cc1744ae 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.214 1998/08/30 05:21:43 wessels Exp $ + * $Id: structs.h,v 1.215 1998/09/03 03:37:36 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1386,6 +1386,8 @@ struct _StatCounters { } netdb; int page_faults; int select_loops; + int select_fds; + double select_time; double cputime; struct timeval timestamp; StatHist comm_icp_incoming; -- 2.47.3