]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
more select stats to debug poor performance
authorwessels <>
Thu, 3 Sep 1998 09:37:33 +0000 (09:37 +0000)
committerwessels <>
Thu, 3 Sep 1998 09:37:33 +0000 (09:37 +0000)
src/comm_select.cc
src/protos.h
src/stat.cc
src/structs.h

index db2d91e1e13af92ced94970b69310a56001a417c..474934cb827336d55a37daf4982944e3e1302761 100644 (file)
@@ -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();
index 134bd280de8c1d6330a451a05e964ba7f56e3bcc..8edac3ad09cc124df4d321e1dfc3f2d5c56c950d 100644 (file)
@@ -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 */
index e5efe03e465fe75ebd11b1e6a0a463c8679cff3a..a5562ed6955fe56f3f46e22f467a0954361ad80d 100644 (file)
@@ -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;
index 8972f1d15ada72fe07a5b4e3790066064aa7646d..36cc1744ae3a896b9cedd24c5c1c7e73e96ccb66 100644 (file)
@@ -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;