]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Moved statCounter out of globals.h into own object file.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 10 Dec 2011 16:29:31 +0000 (17:29 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 10 Dec 2011 16:29:31 +0000 (17:29 +0100)
Changed some operator++ from postfix to prefix.

37 files changed:
src/CacheDigest.cc
src/DiskIO/DiskDaemon/DiskdFile.cc
src/DiskIO/DiskDaemon/DiskdIOStrategy.cc
src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc
src/DiskIO/IpcIo/IpcIoFile.cc
src/Makefile.am
src/PeerDigest.h
src/Server.cc
src/StatCounters.cc [new file with mode: 0644]
src/StatCounters.h
src/client_db.cc
src/client_side.cc
src/comm.cc
src/comm/ModPoll.cc
src/comm/TcpAcceptor.cc
src/comm/Write.cc
src/disk.cc
src/fqdncache.cc
src/fs/ufs/store_dir_ufs.cc
src/ftp.cc
src/globals.h
src/gopher.cc
src/htcp.cc
src/http.cc
src/icp_v2.cc
src/ipcache.cc
src/main.cc
src/stat.cc
src/store.cc
src/store_client.cc
src/store_rebuild.cc
src/store_swapin.cc
src/store_swapout.cc
src/tunnel.cc
src/unlinkd.cc
src/whois.cc

index ac26bde4f8942c2ec545f05d52e36c34150a736b..efa0d65288cbe688bd7532230a1a905832b6110b 100644 (file)
@@ -34,7 +34,7 @@
  */
 
 #include "squid.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "Store.h"
 
 #if USE_CACHE_DIGESTS
index 10e6c52137cb706f736a004139966477390a6666..021e10a70cd4ae1c7a0b03800962ae4d5df8b4cd 100644 (file)
@@ -47,6 +47,7 @@
 #include "DiskIO/IORequestor.h"
 #include "DiskIO/ReadRequest.h"
 #include "DiskIO/WriteRequest.h"
+#include "StatCounters.h"
 CBDATA_CLASS_INIT(DiskdFile);
 
 void *
@@ -275,7 +276,7 @@ DiskdFile::completed(diomsg *M)
 void
 DiskdFile::openDone(diomsg *M)
 {
-    statCounter.syscalls.disk.opens++;
+    ++statCounter.syscalls.disk.opens;
     debugs(79, 3, "storeDiskdOpenDone: status " << M->status);
 
     if (M->status < 0) {
@@ -292,7 +293,7 @@ DiskdFile::openDone(diomsg *M)
 void
 DiskdFile::createDone(diomsg *M)
 {
-    statCounter.syscalls.disk.opens++;
+    ++statCounter.syscalls.disk.opens;
     debugs(79, 3, "storeDiskdCreateDone: status " << M->status);
 
     if (M->status < 0) {
@@ -355,7 +356,7 @@ DiskdFile::ioCompleted()
 void
 DiskdFile::closeDone(diomsg * M)
 {
-    statCounter.syscalls.disk.closes++;
+    ++statCounter.syscalls.disk.closes;
     debugs(79, 3, "DiskdFile::closeDone: status " << M->status);
 
     if (M->status < 0) {
@@ -376,7 +377,7 @@ DiskdFile::closeDone(diomsg * M)
 void
 DiskdFile::readDone(diomsg * M)
 {
-    statCounter.syscalls.disk.reads++;
+    ++statCounter.syscalls.disk.reads;
     debugs(79, 3, "DiskdFile::readDone: status " << M->status);
     assert (M->requestor);
     ReadRequest::Pointer readRequest = dynamic_cast<ReadRequest *>(M->requestor);
@@ -400,7 +401,7 @@ DiskdFile::readDone(diomsg * M)
 void
 DiskdFile::writeDone(diomsg *M)
 {
-    statCounter.syscalls.disk.writes++;
+    ++statCounter.syscalls.disk.writes;
     debugs(79, 3, "storeDiskdWriteDone: status " << M->status);
     assert (M->requestor);
     WriteRequest::Pointer writeRequest = dynamic_cast<WriteRequest *>(M->requestor);
index 64c70128c5897a932ad92c1e33395afe9e40ef37..2f271b336e72fb142315c52e1a647d441289aea6 100644 (file)
@@ -46,6 +46,7 @@
 #include "diomsg.h"
 /* for statfs */
 #include "Store.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 
 diskd_stats_t diskd_stats;
@@ -293,7 +294,7 @@ void
 DiskdIOStrategy::unlinkDone(diomsg * M)
 {
     debugs(79, 3, "storeDiskdUnlinkDone: file " << shm.buf + M->shm_offset << " status " << M->status);
-    statCounter.syscalls.disk.unlinks++;
+    ++statCounter.syscalls.disk.unlinks;
 
     if (M->status < 0)
         diskd_stats.unlink.fail++;
index 0e2f0aed97a11d2abf39e8645a9db202bf288414..4bf6accf334e397024aacdfd380f1ba372cd58ae 100644 (file)
@@ -41,6 +41,7 @@
 #include "DiskIO/IORequestor.h"
 #include "DiskIO/ReadRequest.h"
 #include "DiskIO/WriteRequest.h"
+#include "StatCounters.h"
 
 /* === PUBLIC =========================================================== */
 
@@ -83,7 +84,7 @@ DiskThreadsDiskFile::~DiskThreadsDiskFile()
 void
 DiskThreadsDiskFile::open(int flags, mode_t mode, RefCount<IORequestor> callback)
 {
-    statCounter.syscalls.disk.opens++;
+    ++statCounter.syscalls.disk.opens;
 #if !ASYNC_OPEN
 
     fd = file_open(path_, flags);
@@ -118,7 +119,7 @@ DiskThreadsDiskFile::read(ReadRequest * request)
     debugs(79, 3, "DiskThreadsDiskFile::read: " << this << ", size " << request->len);
     assert (fd > -1);
     assert (ioRequestor.getRaw());
-    statCounter.syscalls.disk.reads++;
+    ++statCounter.syscalls.disk.reads;
     ++inProgressIOs;
 #if ASYNC_READ
 
@@ -132,7 +133,7 @@ DiskThreadsDiskFile::read(ReadRequest * request)
 void
 DiskThreadsDiskFile::create(int flags, mode_t mode, RefCount<IORequestor> callback)
 {
-    statCounter.syscalls.disk.opens++;
+    ++statCounter.syscalls.disk.opens;
 #if !ASYNC_CREATE
 
     int fd = file_open(path_, flags);
@@ -203,7 +204,7 @@ DiskThreadsDiskFile::openDone(int unused, const char *unused2, int anFD, int err
 void DiskThreadsDiskFile::doClose()
 {
     if (fd > -1) {
-        statCounter.syscalls.disk.closes++;
+        ++statCounter.syscalls.disk.closes;
 #if ASYNC_CLOSE
 
         aioClose(fd);
@@ -246,7 +247,7 @@ void
 DiskThreadsDiskFile::write(WriteRequest * writeRequest)
 {
     debugs(79, 3, "DiskThreadsDiskFile::write: FD " << fd);
-    statCounter.syscalls.disk.writes++;
+    ++statCounter.syscalls.disk.writes;
     ++inProgressIOs;
 #if ASYNC_WRITE
 
index 1ba1ecf7665aeaf099e21a38ccc827ad1f4c10f9..c885b293083671bb10c678a1f70d3df689866e08 100644 (file)
@@ -40,6 +40,7 @@
 #include "DiskThreadsIOStrategy.h"
 #include "fde.h"
 #include "mgr/Registration.h"
+#include "StatCounters.h"
 /* for statfs */
 #include "Store.h"
 
@@ -263,6 +264,6 @@ DiskThreadsIOStrategy::unlinkdUseful() const
 void
 DiskThreadsIOStrategy::unlinkFile(char const *path)
 {
-    statCounter.syscalls.disk.unlinks++;
+    ++statCounter.syscalls.disk.unlinks;
     aioUnlink(path, NULL, NULL);
 }
index 8c0a3ecef44ef902bbff5c79cf2bf9906fe5daaf..becbf2e9d3e81c568fe2e694ab8f075a09a28a5e 100644 (file)
@@ -17,6 +17,7 @@
 #include "ipc/StrandSearch.h"
 #include "ipc/UdsOp.h"
 #include "ipc/mem/Pages.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 
 CBDATA_CLASS_INIT(IpcIoFile);
@@ -628,7 +629,7 @@ diskerRead(IpcIoMsg &ipcIo)
 
     char *const buf = Ipc::Mem::PagePointer(ipcIo.page);
     const ssize_t read = pread(TheFile, buf, min(ipcIo.len, Ipc::Mem::PageSize()), ipcIo.offset);
-    statCounter.syscalls.disk.reads++;
+    ++statCounter.syscalls.disk.reads;
     fd_bytes(TheFile, read, FD_READ);
 
     if (read >= 0) {
@@ -650,7 +651,7 @@ diskerWrite(IpcIoMsg &ipcIo)
 {
     const char *const buf = Ipc::Mem::PagePointer(ipcIo.page);
     const ssize_t wrote = pwrite(TheFile, buf, min(ipcIo.len, Ipc::Mem::PageSize()), ipcIo.offset);
-    statCounter.syscalls.disk.writes++;
+    ++statCounter.syscalls.disk.writes;
     fd_bytes(TheFile, wrote, FD_WRITE);
 
     if (wrote >= 0) {
index a489addf57dbb8e3fb9a1beae086751bec49539a..0671627f970dc9cdbf38c64d6411491137b27b1d 100644 (file)
@@ -426,6 +426,7 @@ squid_SOURCES = \
        SquidNew.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        String.cc \
@@ -1084,6 +1085,7 @@ tests_testHttpReply_SOURCES=\
        tests/stub_debug.cc \
        tests/stub_HelperChildConfig.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        tests/stub_StatHist.cc \
        tests/stub_store.cc \
@@ -1361,6 +1363,7 @@ tests_testCacheManager_SOURCES = \
        SquidMath.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -1485,6 +1488,7 @@ tests_testDiskIO_SOURCES = \
        refresh.cc \
        RemovalPolicy.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -1690,6 +1694,7 @@ tests_testEvent_SOURCES = \
        SquidMath.h \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -1881,6 +1886,7 @@ tests_testEventLoop_SOURCES = \
        SquidMath.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -2068,6 +2074,7 @@ tests_test_http_range_SOURCES = \
        SquidMath.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -2294,6 +2301,7 @@ tests_testHttpRequest_SOURCES = \
        SquidMath.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -2410,6 +2418,7 @@ tests_testStore_SOURCES= \
        RemovalPolicy.cc \
        refresh.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -2643,6 +2652,7 @@ tests_testUfs_SOURCES = \
        HttpHdrScTarget.cc \
        url.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        HttpHdrRange.cc \
@@ -2737,6 +2747,7 @@ tests_testRock_SOURCES = \
        Parsing.cc \
        RemovalPolicy.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
@@ -2906,6 +2917,7 @@ tests_testCoss_SOURCES = \
        HttpHdrScTarget.cc \
        url.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        HttpHdrRange.cc \
@@ -3042,6 +3054,7 @@ tests_testNull_SOURCES = \
        HttpHdrScTarget.cc \
        url.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        HttpHdrRange.cc \
@@ -3193,6 +3206,7 @@ tests_testURL_SOURCES = \
        SquidMath.cc \
        stat.cc \
        StatCounters.h \
+       StatCounters.cc \
        StatHist.h \
        StatHist.cc \
        stmem.cc \
index 9f805e15a2014562568ff6a096efdcc8d73c55a3..789e3a55baa40c25201a12b2f4488cd5d81df45b 100644 (file)
@@ -39,6 +39,7 @@
 #if USE_CACHE_DIGESTS
 
 #include "cbdata.h"
+#include "StatCounters.h" /* for cd_guess_stats */
 
 struct _Version {
     short int current;         /* current version */
index be3ad71a122980e9d4c6880f28b1b5c4420f1e23..13e1d76adcb57a2a5ccf975f3421e5f1d2ddb603 100644 (file)
@@ -44,6 +44,7 @@
 #include "HttpReply.h"
 #include "errorpage.h"
 #include "err_detail_type.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 
 #if USE_ADAPTATION
@@ -365,7 +366,7 @@ ServerStateData::sentRequestBody(const CommIoCbParams &io)
 
     if (io.size > 0) {
         fd_bytes(io.fd, io.size, FD_WRITE);
-        kb_incr(&statCounter.server.all.kbytes_out, io.size);
+        kb_incr(&(statCounter.server.all.kbytes_out), io.size);
         // kids should increment their counters
     }
 
diff --git a/src/StatCounters.cc b/src/StatCounters.cc
new file mode 100644 (file)
index 0000000..53d62df
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ *  AUTHOR: Francesco Chemolli (Harvest-derived)
+ *
+ */
+
+#include "config.h"
+#include "StatCounters.h"
+
+StatCounters *StatCounters::counters;
+StatCounters statCounter;
index f871338a8b2ea5c8c123281dca9452bd12001159..4e57e709556e58ee42f564f39fa6e10410d85525 100644 (file)
@@ -1,10 +1,33 @@
 /*
- * StatCounters.h
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ *  AUTHOR: Francesco Chemolli (Harvest-derived)
  *
- *  Created on: Dec 9, 2011
- *      Author: kinkie
  */
-
 #ifndef STATCOUNTERS_H_
 #define STATCOUNTERS_H_
 
@@ -32,7 +55,6 @@ public:
  */
 class StatCounters {
 public:
-
     struct {
         int clients;
         int requests;
@@ -156,7 +178,10 @@ public:
         int outs;
         int ins;
     } swap;
+
+private:
 };
 
+extern StatCounters statCounter;
 
 #endif /* STATCOUNTERS_H_ */
index 213ff7557986a9fc3104a36a85fcc8f95b3a7761..cbf1387eb776860696610487c29ad400caaeae1c 100644 (file)
@@ -40,6 +40,7 @@
 #include "mgr/Registration.h"
 #include "SquidMath.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "Store.h"
 
 
@@ -92,7 +93,7 @@ clientdbAdd(const Ip::Address &addr)
     c->prevTime=current_dtime;/* put current time to have something sensible here */
 #endif
     hash_join(client_table, &c->hash);
-    statCounter.client_http.clients++;
+    ++statCounter.client_http.clients;
 
     if ((statCounter.client_http.clients > max_clients) && !cleanup_running && cleanup_scheduled < 2) {
         cleanup_scheduled++;
@@ -404,7 +405,7 @@ clientdbGC(void *unused)
 
         clientdbFreeItem(c);
 
-        statCounter.client_http.clients--;
+        --statCounter.client_http.clients;
 
         cleanup_removed++;
     }
index f134d88dee3575e08e9e7ec6e34acbdd55240ec8..e31e80c767c14f2a3f82b9965a631afe4f451331 100644 (file)
@@ -427,15 +427,15 @@ clientIdentDone(const char *ident, void *data)
 void
 clientUpdateStatCounters(log_type logType)
 {
-    statCounter.client_http.requests++;
+    ++statCounter.client_http.requests;
 
     if (logTypeIsATcpHit(logType))
-        statCounter.client_http.hits++;
+        ++statCounter.client_http.hits;
 
     if (logType == LOG_TCP_HIT)
-        statCounter.client_http.disk_hits++;
+        ++statCounter.client_http.disk_hits;
     else if (logType == LOG_TCP_MEM_HIT)
-        statCounter.client_http.mem_hits++;
+        ++statCounter.client_http.mem_hits;
 }
 
 void
@@ -2822,7 +2822,7 @@ ConnStateData::clientReadRequest(const CommIoCbParams &io)
 
     if (io.flag == COMM_OK) {
         if (io.size > 0) {
-            kb_incr(&statCounter.client_http.kbytes_in, io.size);
+            kb_incr(&(statCounter.client_http.kbytes_in), io.size);
 
             // may comm_close or setReplyToError
             if (!handleReadData(io.buf, io.size))
index 5627d11589ee288ac5bb74e03ea59f059990a18b..881a3c8a696a7b53ef09035b03ba54f26a7f463f 100644 (file)
@@ -58,6 +58,7 @@
 #include "ip/QosConfig.h"
 #include "ip/tools.h"
 #include "ClientInfo.h"
+#include "StatCounters.h"
 #if USE_SSL
 #include "ssl/support.h"
 #endif
index b190500dff1fa42c67c64a8f9fa6fbd792b77a4c..e57a34c6b909abca2bd8d2b95d6dec1332e78a08 100644 (file)
@@ -41,7 +41,7 @@
 #include "ICP.h"
 #include "mgr/Registration.h"
 #include "SquidTime.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "Store.h"
 
 #if HAVE_POLL_H
@@ -642,7 +642,7 @@ Comm::SelectLoopInit(void)
 static void
 commIncomingStats(StoreEntry * sentry)
 {
-    StatCounters *f = &statCounter;
+    StatCounters *f = StatCounters::GetCounters();
     storeAppendPrintf(sentry, "Current incoming_icp_interval: %d\n",
                       incoming_icp_interval >> INCOMING_FACTOR);
     storeAppendPrintf(sentry, "Current incoming_dns_interval: %d\n",
index 221394bf20eded834b31d133a86b4a5de91fd4f3..f3feb7b170cd5a5e50a1145ceaf5c4e61dc5b0cf 100644 (file)
@@ -44,6 +44,7 @@
 #include "ip/Intercept.h"
 #include "protos.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 
 namespace Comm
 {
@@ -296,7 +297,7 @@ comm_err_t
 Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
 {
     PROF_start(comm_accept);
-    statCounter.syscalls.sock.accepts++;
+    ++statCounter.syscalls.sock.accepts;
     int sock;
     struct addrinfo *gai = NULL;
     details->local.InitAddrInfo(gai);
index 4d5cf46a69de5d1df00f013d1f0b5b069f792e03..88783d75a253e535fe2351190e2488357deb4707 100644 (file)
@@ -6,6 +6,7 @@
 #include "comm/IoCallback.h"
 #include "comm/Write.h"
 #include "fde.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 #include "MemBuf.h"
 
@@ -108,7 +109,7 @@ Comm::HandleWrite(int fd, void *data)
 #endif /* USE_DELAY_POOLS */
 
     fd_bytes(fd, len, FD_WRITE);
-    statCounter.syscalls.sock.writes++;
+    ++statCounter.syscalls.sock.writes;
     // After each successful partial write,
     // reset fde::writeStart to the current time.
     fd_table[fd].writeStart = squid_curtime;
index c5d0c51a98f4d703b9a875dbdfd5628454ea7e72..04e1a5395124707aef47ab8e0d019f79a1d7d62a 100644 (file)
@@ -36,6 +36,7 @@
 #include "comm/Loops.h"
 #include "fde.h"
 #include "MemBuf.h"
+#include "StatCounters.h"
 
 static PF diskHandleRead;
 static PF diskHandleWrite;
@@ -442,7 +443,7 @@ diskHandleRead(int fd, void *data)
 #endif
         debugs(6, 3, "diskHandleRead: FD " << fd << " seeking to offset " << ctrl_dat->offset);
         lseek(fd, ctrl_dat->offset, SEEK_SET); /* XXX ignore return? */
-        statCounter.syscalls.disk.seeks++;
+        ++statCounter.syscalls.disk.seeks;
         F->disk.offset = ctrl_dat->offset;
     }
 
index b01d2434e49459f0c7bb095cb170cd63ea1d0993..08b71d98ac359330dce64c125c1b9f5fcf5c0143 100644 (file)
@@ -38,7 +38,7 @@
 #include "event.h"
 #include "mgr/Registration.h"
 #include "SquidTime.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "Store.h"
 #include "wordlist.h"
 
index 609c32842c3ac2607e6d54ddc51089a5af144c2d..8b856d2806026e5797d17187645b6a14795574a1 100644 (file)
@@ -44,6 +44,7 @@
 #include "Parsing.h"
 #include "SquidMath.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "SwapDir.h"
 #include "swap_log_op.h"
 
@@ -1144,7 +1145,7 @@ UFSSwapDir::DirClean(int swap_index)
         debugs(36, 3, "storeDirClean: Cleaning file "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << files[n]);
         snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]);
         safeunlink(p2, 0);
-        statCounter.swap.files_cleaned++;
+        ++statCounter.swap.files_cleaned;
     }
 
     debugs(36, 3, "Cleaned " << k << " unused files from " << p1);
index ae73d6eb9a66dc1ca9e307b2dd0b42fa2c15aa7b..7b7e6edd80c64bd536a6f450951747a6db939ace 100644 (file)
@@ -54,6 +54,7 @@
 #include "Server.h"
 #include "SquidString.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "Store.h"
 #include "URLScheme.h"
 #include "wordlist.h"
@@ -1257,8 +1258,8 @@ FtpStateData::dataRead(const CommIoCbParams &io)
     debugs(9, 3, HERE << "ftpDataRead: FD " << io.fd << " Read " << io.size << " bytes");
 
     if (io.size > 0) {
-        kb_incr(&statCounter.server.all.kbytes_in, io.size);
-        kb_incr(&statCounter.server.ftp.kbytes_in, io.size);
+        kb_incr(&(statCounter.server.all.kbytes_in), io.size);
+        kb_incr(&(statCounter.server.ftp.kbytes_in), io.size);
     }
 
     if (io.flag == COMM_ERR_CLOSING)
@@ -1613,8 +1614,8 @@ FtpStateData::ftpWriteCommandCallback(const CommIoCbParams &io)
 
     if (io.size > 0) {
         fd_bytes(io.fd, io.size, FD_WRITE);
-        kb_incr(&statCounter.server.all.kbytes_out, io.size);
-        kb_incr(&statCounter.server.ftp.kbytes_out, io.size);
+        kb_incr(&(statCounter.server.all.kbytes_out), io.size);
+        kb_incr(&(statCounter.server.ftp.kbytes_out), io.size);
     }
 
     if (io.flag == COMM_ERR_CLOSING)
@@ -1754,8 +1755,8 @@ void FtpStateData::ftpReadControlReply(const CommIoCbParams &io)
     debugs(9, 3, "ftpReadControlReply: FD " << io.fd << ", Read " << io.size << " bytes");
 
     if (io.size > 0) {
-        kb_incr(&statCounter.server.all.kbytes_in, io.size);
-        kb_incr(&statCounter.server.ftp.kbytes_in, io.size);
+        kb_incr(&(statCounter.server.all.kbytes_in), io.size);
+        kb_incr(&(statCounter.server.ftp.kbytes_in), io.size);
     }
 
     if (io.flag == COMM_ERR_CLOSING)
@@ -3317,7 +3318,7 @@ void
 FtpStateData::sentRequestBody(const CommIoCbParams &io)
 {
     if (io.size > 0)
-        kb_incr(&statCounter.server.ftp.kbytes_out, io.size);
+        kb_incr(&(statCounter.server.ftp.kbytes_out), io.size);
     ServerStateData::sentRequestBody(io);
 }
 
index 104b3ecc02482ec6b73e6492d60b33ae487c071b..4165e0090cebbdb9083a440fdb3d2ee6b0c157b6 100644 (file)
@@ -41,7 +41,6 @@
 /* for ERROR_BUF_SZ, BUFSIZ, MAXHTTPPORTS */
 #include "defines.h"
 
-#include "StatCounters.h"
 /* for iostats */
 #include "structs.h"
 
@@ -110,7 +109,6 @@ extern "C" {
     extern int shutting_down;  /* 0 */
     extern int reconfiguring;  /* 0 */
     extern time_t hit_only_mode_until; /* 0 */
-    extern StatCounters statCounter;
     extern double request_failure_ratio;       /* 0.0 */
     extern int store_hash_buckets;     /* 0 */
     extern hash_table *store_table;    /* NULL */
index 5a527b085388ec7eb10f7539033f65817bd94899..894d72f0af2c39650dfd7edbf9d32540bbb63179 100644 (file)
@@ -48,6 +48,7 @@
 #include "MemBuf.h"
 #include "forward.h"
 #include "rfc1738.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 
 /**
@@ -769,8 +770,8 @@ gopherReadReply(const Comm::ConnectionPointer &conn, char *buf, size_t len, comm
         delayId.bytesIn(len);
 #endif
 
-        kb_incr(&statCounter.server.all.kbytes_in, len);
-        kb_incr(&statCounter.server.other.kbytes_in, len);
+        kb_incr(&(statCounter.server.all.kbytes_in), len);
+        kb_incr(&(statCounter.server.other.kbytes_in), len);
     }
 
     debugs(10, 5, HERE << conn << " read len=" << len);
@@ -844,8 +845,8 @@ gopherSendComplete(const Comm::ConnectionPointer &conn, char *buf, size_t size,
 
     if (size > 0) {
         fd_bytes(conn->fd, size, FD_WRITE);
-        kb_incr(&statCounter.server.all.kbytes_out, size);
-        kb_incr(&statCounter.server.other.kbytes_out, size);
+        kb_incr(&(statCounter.server.all.kbytes_out), size);
+        kb_incr(&(statCounter.server.other.kbytes_out), size);
     }
 
     if (errflag) {
index 20101df6b5ae030ee7fa20b0c3fc67013f97ff8d..1b8272b353f63e82c30c443ec8c04ddc3ee0f218 100644 (file)
@@ -47,6 +47,7 @@
 #include "ip/tools.h"
 #include "MemBuf.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "Store.h"
 #include "StoreClient.h"
 #include "compat/xalloc.h"
index 232b125cc3735e5bc9ab8ab97ae8db6336114ad9..60d0738ce26d601a0567a130f42982eef77fad02 100644 (file)
@@ -68,6 +68,7 @@
 #include "protos.h"
 #include "rfc1738.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "Store.h"
 
 
@@ -1095,8 +1096,8 @@ HttpStateData::readReply(const CommIoCbParams &io)
         delayId.bytesIn(len);
 #endif
 
-        kb_incr(&statCounter.server.all.kbytes_in, len);
-        kb_incr(&statCounter.server.http.kbytes_in, len);
+        kb_incr(&(statCounter.server.all.kbytes_in), len);
+        kb_incr(&(statCounter.server.http.kbytes_in), len);
         IOStats.Http.reads++;
 
         for (clen = len - 1, bin = 0; clen; bin++)
@@ -1465,8 +1466,8 @@ HttpStateData::wroteLast(const CommIoCbParams &io)
 
     if (io.size > 0) {
         fd_bytes(io.fd, io.size, FD_WRITE);
-        kb_incr(&statCounter.server.all.kbytes_out, io.size);
-        kb_incr(&statCounter.server.http.kbytes_out, io.size);
+        kb_incr(&(statCounter.server.all.kbytes_out), io.size);
+        kb_incr(&(statCounter.server.http.kbytes_out), io.size);
     }
 
     if (io.flag == COMM_ERR_CLOSING)
index b0835343c01beb6e6f890286a91795344a08aac9..9f3d057f34a42379900642797dd0bc8b56bbedf4 100644 (file)
@@ -46,7 +46,7 @@
 #include "acl/Acl.h"
 #include "AccessLogEntry.h"
 #include "wordlist.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "SquidTime.h"
 #include "SwapDir.h"
 #include "icmp/net_db.h"
index 570d83f8ad8aac9c4459f29430687d61ff8353b5..8eb69b29257066b70eea6372c516f9a572aa3263 100644 (file)
@@ -40,7 +40,7 @@
 #include "ipcache.h"
 #include "mgr/Registration.h"
 #include "SquidTime.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "Store.h"
 #include "wordlist.h"
 
index 5fdc1c9b894bb7463d7e4e47ad9fa085dc26ce3a..2a94775a5796f5a56cbd8beea319e6d54e830162 100644 (file)
@@ -82,6 +82,7 @@
 #include "ipc/Strand.h"
 #include "ip/tools.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "SwapDir.h"
 #include "forward.h"
 #include "MemPool.h"
index 033782e0172d72d4c06828e6899702593977d029..0f0b4d74634da42d0d4eb6409b46a39d48830702 100644 (file)
@@ -54,7 +54,7 @@
 #include "MemBuf.h"
 #include "SquidMath.h"
 #include "SquidTime.h"
-#include "StatHist.h"
+#include "StatCounters.h"
 #include "mgr/CountersAction.h"
 #include "mgr/FunAction.h"
 #include "mgr/InfoAction.h"
index f017ff874b0397d7cb081d6a3f5bf6185e00bb14..9e9cb3b3bb3e267b1975b00a5173e6aa46c872b7 100644 (file)
@@ -47,6 +47,7 @@
 #include "HttpRequest.h"
 #include "MemObject.h"
 #include "mem_node.h"
+#include "StatCounters.h"
 #include "StoreMeta.h"
 #include "SwapDir.h"
 #include "StoreIOState.h"
index 55ed6a2dfed75b77b4c29811f5dc2849d35230e8..f8bd81bfdfc0176ea9144ec63068a077fc452226 100644 (file)
@@ -40,6 +40,7 @@
 #include "Store.h"
 #include "HttpReply.h"
 #include "MemObject.h"
+#include "StatCounters.h"
 #include "StoreMeta.h"
 #include "StoreMetaUnpacker.h"
 #if USE_DELAY_POOLS
index 9962646f5159e87e2511dfb7348a69d5c09e57ea..fe88871132fade8ad9847843a272b17ebae3d68b 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "squid.h"
 #include "event.h"
+#include "StatCounters.h"
 #include "Store.h"
 #include "SwapDir.h"
 #include "StoreSearch.h"
index d993b62d06d19284bda21ebdce92f5085fc1a7a2..6d9d105a1e0ee6f2d8ea9b4794937702eb9c589b 100644 (file)
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "StatCounters.h"
 #include "StoreClient.h"
 #include "Store.h"
 
@@ -84,7 +85,7 @@ storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer self)
         sc->callback(0, errflag ? true : false);
     }
 
-    statCounter.swap.ins++;
+    ++statCounter.swap.ins;
 }
 
 static void
index aa4eefdb791c370561f50f7d30e021c0f584b224..a11638bd6f2258737acc1dfb01fbd5e1c6c7c9ab 100644 (file)
@@ -41,6 +41,7 @@
 #include "mem_node.h"
 #include "MemObject.h"
 #include "SwapDir.h"
+#include "StatCounters.h"
 #include "swap_log_op.h"
 
 static void storeSwapOutStart(StoreEntry * e);
@@ -365,7 +366,7 @@ storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self)
             storeDirSwapLog(e, SWAP_LOG_ADD);
         }
 
-        statCounter.swap.outs++;
+        ++statCounter.swap.outs;
     }
 
     debugs(20, 3, "storeSwapOutFileClosed: " << __FILE__ << ":" << __LINE__);
index 67c0b5e0e4574d9f10777dce1d73bcedc157f7a2..dbad0d7f094a5911dadb6dbc79e942fe93f8b699 100644 (file)
@@ -51,6 +51,7 @@
 #include "MemBuf.h"
 #include "http.h"
 #include "PeerSelectState.h"
+#include "StatCounters.h"
 
 class TunnelStateData
 {
@@ -249,8 +250,8 @@ TunnelStateData::readServer(char *buf, size_t len, comm_err_t errcode, int xerrn
 
     if (len > 0) {
         server.bytesIn(len);
-        kb_incr(&statCounter.server.all.kbytes_in, len);
-        kb_incr(&statCounter.server.other.kbytes_in, len);
+        kb_incr(&(statCounter.server.all.kbytes_in), len);
+        kb_incr(&(statCounter.server.other.kbytes_in), len);
     }
 
     copy (len, errcode, xerrno, server, client, WriteClientDone);
@@ -293,7 +294,7 @@ TunnelStateData::readClient(char *buf, size_t len, comm_err_t errcode, int xerrn
 
     if (len > 0) {
         client.bytesIn(len);
-        kb_incr(&statCounter.client_http.kbytes_in, len);
+        kb_incr(&(statCounter.client_http.kbytes_in), len);
     }
 
     copy (len, errcode, xerrno, client, server, WriteServerDone);
@@ -369,8 +370,8 @@ TunnelStateData::writeServerDone(char *buf, size_t len, comm_err_t flag, int xer
     }
 
     /* Valid data */
-    kb_incr(&statCounter.server.all.kbytes_out, len);
-    kb_incr(&statCounter.server.other.kbytes_out, len);
+    kb_incr(&(statCounter.server.all.kbytes_out), len);
+    kb_incr(&(statCounter.server.other.kbytes_out), len);
     client.dataSent(len);
 
     /* If the other end has closed, so should we */
@@ -432,7 +433,7 @@ TunnelStateData::writeClientDone(char *buf, size_t len, comm_err_t flag, int xer
     }
 
     /* Valid data */
-    kb_incr(&statCounter.client_http.kbytes_out, len);
+    kb_incr(&(statCounter.client_http.kbytes_out), len);
     server.dataSent(len);
 
     /* If the other end has closed, so should we */
index 96dbf9d12c37869fd43348d5ca6664a57329acad..f79d9634b840bf69116307021898db9519239fbf 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "squid.h"
 #include "SquidTime.h"
+#include "StatCounters.h"
 #include "SwapDir.h"
 #include "fde.h"
 #include "xusleep.h"
@@ -131,13 +132,13 @@ unlinkdUnlink(const char *path)
         return;
     }
 
-    statCounter.unlink.requests++;
+    ++statCounter.unlink.requests;
     /*
     * Increment this syscalls counter here, even though the syscall
     * is executed by the helper process.  We try to be consistent
     * in counting unlink operations.
     */
-    statCounter.syscalls.disk.unlinks++;
+    ++statCounter.syscalls.disk.unlinks;
     queuelen++;
 }
 
index 27217e9fc1fe17561426a0df3c72fc469aa7f9bc..9573c72ea4d3a6689091e64fbc6681702b801984 100644 (file)
@@ -42,6 +42,7 @@
 #include "comm.h"
 #include "HttpRequest.h"
 #include "forward.h"
+#include "StatCounters.h"
 
 #define WHOIS_PORT 43
 
@@ -169,8 +170,8 @@ WhoisState::readReply(const Comm::ConnectionPointer &conn, char *aBuffer, size_t
         if (!dataWritten)
             setReplyToOK(entry);
 
-        kb_incr(&statCounter.server.all.kbytes_in, aBufferLength);
-        kb_incr(&statCounter.server.http.kbytes_in, aBufferLength);
+        kb_incr(&(statCounter.server.all.kbytes_in), aBufferLength);
+        kb_incr(&(statCounter.server.http.kbytes_in), aBufferLength);
 
         /* No range support, we always grab it all */
         dataWritten = true;