From: Francesco Chemolli Date: Mon, 17 Sep 2012 15:12:01 +0000 (+0200) Subject: renamed class iostats to IoStats, moved to own header file. X-Git-Tag: SQUID_3_3_0_1~33^2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ce629cfa6d335ff169a081ff29d7a869e854dbe;p=thirdparty%2Fsquid.git renamed class iostats to IoStats, moved to own header file. --- diff --git a/src/ConfigParser.cc b/src/ConfigParser.cc index 848428260b..7c81e44256 100644 --- a/src/ConfigParser.cc +++ b/src/ConfigParser.cc @@ -35,6 +35,7 @@ #include "cache_cf.h" #include "ConfigParser.h" #include "Debug.h" +#include "fatal.h" #include "globals.h" void diff --git a/src/IoStats.h b/src/IoStats.h new file mode 100644 index 0000000000..2329605e8d --- /dev/null +++ b/src/IoStats.h @@ -0,0 +1,47 @@ +#ifndef SQUID_IOSTATS_H_ +#define SQUID_IOSTATS_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. + * + */ + +class IoStats { +public: + static const int histSize=16; + + struct { + int reads; + int reads_deferred; + int read_hist[histSize]; + int writes; + int write_hist[histSize]; + } + + Http, Ftp, Gopher; +}; + +#endif /* SQUID_IOSTATS_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am index 21fe2588b6..21eb44ec09 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -468,6 +468,7 @@ squid_SOURCES = \ SquidMath.h \ SquidMath.cc \ SquidNew.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -1501,6 +1502,7 @@ tests_testCacheManager_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.h \ SquidMath.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -1909,6 +1911,7 @@ tests_testEvent_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.cc \ SquidMath.h \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -2148,6 +2151,7 @@ tests_testEventLoop_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.h \ SquidMath.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -2386,6 +2390,7 @@ tests_test_http_range_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.h \ SquidMath.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -2667,6 +2672,7 @@ tests_testHttpRequest_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.h \ SquidMath.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ @@ -3747,6 +3753,7 @@ tests_testURL_SOURCES = \ $(SNMP_SOURCE) \ SquidMath.h \ SquidMath.cc \ + IoStats.h \ stat.h \ stat.cc \ StatCounters.h \ diff --git a/src/globals.h b/src/globals.h index d6094356cc..3980d926d8 100644 --- a/src/globals.h +++ b/src/globals.h @@ -30,20 +30,17 @@ #ifndef SQUID_GLOBALS_H #define SQUID_GLOBALS_H +#include "acl/AclDenyInfoList.h" +#include "CacheDigest.h" +#include "defines.h" +#include "hash.h" +#include "IoStats.h" +#include "rfc2181.h" + #if HAVE_STDIO_H #include #endif -#include "rfc2181.h" - -/* for ERROR_BUF_SZ, BUFSIZ */ -#include "defines.h" - -/* for iostats */ -#include "acl/AclDenyInfoList.h" -#include "CacheDigest.h" -#include "structs.h" - extern char *ConfigFile; /* NULL */ extern char *IcpOpcodeStr[]; extern char tmp_error_buf[ERROR_BUF_SZ]; @@ -87,7 +84,7 @@ extern int syslog_enable; /* 0 */ extern int DnsSocketA; /* -1 */ extern int DnsSocketB; /* -1 */ extern int n_disk_objects; /* 0 */ -extern iostats IOStats; +extern IoStats IOStats; extern AclDenyInfoList *DenyInfoList; /* NULL */ diff --git a/src/mgr/IoAction.cc b/src/mgr/IoAction.cc index 421a903e1f..06cfbbd2e3 100644 --- a/src/mgr/IoAction.cc +++ b/src/mgr/IoAction.cc @@ -5,6 +5,7 @@ #include "squid.h" #include "base/TextException.h" +#include "IoStats.h" #include "ipc/Messages.h" #include "ipc/TypedMsgHdr.h" #include "mgr/IoAction.h" @@ -24,13 +25,13 @@ Mgr::IoActionData& Mgr::IoActionData::operator += (const IoActionData& stats) { http_reads += stats.http_reads; - for (int i = 0; i < iostats::histSize; ++i) + for (int i = 0; i < IoStats::histSize; ++i) http_read_hist[i] += stats.http_read_hist[i]; ftp_reads += stats.ftp_reads; - for (int i = 0; i < iostats::histSize; ++i) + for (int i = 0; i < IoStats::histSize; ++i) ftp_read_hist[i] += stats.ftp_read_hist[i]; gopher_reads += stats.gopher_reads; - for (int i = 0; i < iostats::histSize; ++i) + for (int i = 0; i < IoStats::histSize; ++i) gopher_read_hist[i] += stats.gopher_read_hist[i]; return *this; diff --git a/src/mgr/IoAction.h b/src/mgr/IoAction.h index 0925a2c596..6487247c1f 100644 --- a/src/mgr/IoAction.h +++ b/src/mgr/IoAction.h @@ -7,7 +7,7 @@ #define SQUID_MGR_IO_ACTION_H #include "mgr/Action.h" -#include "structs.h" /* iostats::histSize */ +#include "IoStats.h" namespace Mgr { @@ -23,9 +23,9 @@ public: double http_reads; double ftp_reads; double gopher_reads; - double http_read_hist[iostats::histSize]; - double ftp_read_hist[iostats::histSize]; - double gopher_read_hist[iostats::histSize]; + double http_read_hist[IoStats::histSize]; + double ftp_read_hist[IoStats::histSize]; + double gopher_read_hist[IoStats::histSize]; }; /// implement aggregated 'io' action diff --git a/src/stat.cc b/src/stat.cc index c78cf1b003..d65681eeee 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -42,6 +42,7 @@ #include "format/Token.h" #include "globals.h" #include "HttpRequest.h" +#include "IoStats.h" #include "MemObject.h" #include "mem_node.h" #include "MemBuf.h" @@ -221,19 +222,19 @@ GetIoStats(Mgr::IoActionData& stats) stats.http_reads = IOStats.Http.reads; - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { stats.http_read_hist[i] = IOStats.Http.read_hist[i]; } stats.ftp_reads = IOStats.Ftp.reads; - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { stats.ftp_read_hist[i] = IOStats.Ftp.read_hist[i]; } stats.gopher_reads = IOStats.Gopher.reads; - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { stats.gopher_read_hist[i] = IOStats.Gopher.read_hist[i]; } } @@ -247,7 +248,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry) storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.http_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, @@ -260,7 +261,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry) storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.ftp_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, @@ -273,7 +274,7 @@ DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry) storeAppendPrintf(sentry, "number of reads: %.0f\n", stats.gopher_reads); storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < iostats::histSize; ++i) { + for (i = 0; i < IoStats::histSize; ++i) { storeAppendPrintf(sentry, "%5d-%5d: %9.0f %2.0f%%\n", i ? (1 << (i - 1)) + 1 : 1, 1 << i, diff --git a/src/structs.h b/src/structs.h index a47763582e..63e7c38a40 100644 --- a/src/structs.h +++ b/src/structs.h @@ -218,23 +218,6 @@ public: int n_peers; }; -class iostats { -public: - static const int histSize=16; - -// enum { histSize = 16 }; - - struct { - int reads; - int reads_deferred; - int read_hist[histSize]; - int writes; - int write_hist[histSize]; - } - - Http, Ftp, Gopher; -}; - #if USE_SSL struct _sslproxy_cert_sign { int alg; diff --git a/src/tests/stub_cache_cf.cc b/src/tests/stub_cache_cf.cc index 699ee23e02..f46821d69e 100644 --- a/src/tests/stub_cache_cf.cc +++ b/src/tests/stub_cache_cf.cc @@ -31,6 +31,7 @@ */ #include "squid.h" +#include "acl/Acl.h" #include "ConfigParser.h" #include "wordlist.h" #include "YesNoNone.h" diff --git a/src/wordlist.h b/src/wordlist.h index 31a0536e41..cdbd82a0d1 100644 --- a/src/wordlist.h +++ b/src/wordlist.h @@ -45,6 +45,8 @@ public: MEMPROXY_CLASS_INLINE(wordlist); +class MemBuf; + extern const char *wordlistAdd(wordlist **, const char *); extern void wordlistCat(const wordlist *, MemBuf * mb); extern void wordlistAddWl(wordlist **, wordlist *);