From 3060f6e772060c79d85009a2ac4894a821006ece Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Fri, 3 Jul 2009 12:36:45 +1200 Subject: [PATCH] Author: Francesco Chemolli Bug 2092: Changed select loop call counter to 64-bit ... unsigned long int so that it won't wrap around so easily. Changed select loops counter from int to unsigned long int. --- src/comm_epoll.cc | 4 ++-- src/comm_kqueue.cc | 2 +- src/comm_poll.cc | 4 ++-- src/comm_select.cc | 2 +- src/comm_select_win32.cc | 4 ++-- src/stat.cc | 4 ++-- src/structs.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/comm_epoll.cc b/src/comm_epoll.cc index 9dccfce6d4..9d9031430b 100644 --- a/src/comm_epoll.cc +++ b/src/comm_epoll.cc @@ -232,7 +232,7 @@ static void commIncomingStats(StoreEntry * sentry) { StatCounters *f = &statCounter; - storeAppendPrintf(sentry, "Total number of epoll(2) loops: %d\n", statCounter.select_loops); + storeAppendPrintf(sentry, "Total number of epoll(2) loops: %ld\n", statCounter.select_loops); storeAppendPrintf(sentry, "Histogram of returned filedescriptors\n"); statHistDump(&f->select_fds_hist, sentry, statHistIntDumper); } @@ -265,7 +265,7 @@ comm_select(int msec) for (;;) { num = epoll_wait(kdpfd, pevents, SQUID_MAXFD, msec); - statCounter.select_loops++; + ++statCounter.select_loops; if (num >= 0) break; diff --git a/src/comm_kqueue.cc b/src/comm_kqueue.cc index f40a20e63d..f0b30b18a1 100644 --- a/src/comm_kqueue.cc +++ b/src/comm_kqueue.cc @@ -260,7 +260,7 @@ comm_select(int msec) for (;;) { num = kevent(kq, kqlst, kqoff, ke, KE_LENGTH, &poll_time); - statCounter.select_loops++; + ++statCounter.select_loops; kqoff = 0; if (num >= 0) diff --git a/src/comm_poll.cc b/src/comm_poll.cc index 881ee90463..7c785a412f 100644 --- a/src/comm_poll.cc +++ b/src/comm_poll.cc @@ -408,9 +408,9 @@ comm_select(int msec) for (;;) { PROF_start(comm_poll_normal); - statCounter.syscalls.selects++; + ++statCounter.syscalls.selects; num = poll(pfds, nfds, msec); - statCounter.select_loops++; + ++statCounter.select_loops; PROF_stop(comm_poll_normal); if (num >= 0 || npending >= 0) diff --git a/src/comm_select.cc b/src/comm_select.cc index 6e426f05e1..d527b42275 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -441,7 +441,7 @@ comm_select(int msec) poll_time.tv_usec = (msec % 1000) * 1000; statCounter.syscalls.selects++; num = select(maxfd, &readfds, &writefds, NULL, &poll_time); - statCounter.select_loops++; + ++statCounter.select_loops; if (num >= 0 || pending > 0) break; diff --git a/src/comm_select_win32.cc b/src/comm_select_win32.cc index 041fa4e3ce..f099f8b70d 100644 --- a/src/comm_select_win32.cc +++ b/src/comm_select_win32.cc @@ -439,9 +439,9 @@ comm_select(int msec) for (;;) { poll_time.tv_sec = msec / 1000; poll_time.tv_usec = (msec % 1000) * 1000; - statCounter.syscalls.selects++; + ++statCounter.syscalls.selects; num = select(maxfd, &readfds, &writefds, &errfds, &poll_time); - statCounter.select_loops++; + ++statCounter.select_loops; if (num >= 0 || pending > 0) break; diff --git a/src/stat.cc b/src/stat.cc index 9bc2200ad3..3293115179 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -514,7 +514,7 @@ info_get(StoreEntry * sentry) storeAppendPrintf(sentry, "\tAverage ICP messages per minute since start:\t%.1f\n", (statCounter.icp.pkts_sent + statCounter.icp.pkts_recv) / (runtime / 60.0)); - storeAppendPrintf(sentry, "\tSelect loop called: %d times, %0.3f ms avg\n", + storeAppendPrintf(sentry, "\tSelect loop called: %ld times, %0.3f ms avg\n", statCounter.select_loops, 1000.0 * runtime / statCounter.select_loops); storeAppendPrintf(sentry, "Cache information for %s:\n",APP_SHORTNAME); @@ -1367,7 +1367,7 @@ statCountersDump(StoreEntry * sentry) f->unlink.requests); storeAppendPrintf(sentry, "page_faults = %d\n", f->page_faults); - storeAppendPrintf(sentry, "select_loops = %d\n", + storeAppendPrintf(sentry, "select_loops = %ld\n", f->select_loops); storeAppendPrintf(sentry, "cpu_time = %f\n", f->cputime); diff --git a/src/structs.h b/src/structs.h index 27ffee5c97..dd201c54dd 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1190,7 +1190,7 @@ struct _StatCounters { int times_used; } netdb; int page_faults; - int select_loops; + unsigned long int select_loops; int select_fds; double select_time; double cputime; -- 2.47.3