From: Francesco Chemolli Date: Mon, 5 Dec 2011 16:52:47 +0000 (+0100) Subject: Moved StatHist class to its own header-file, included the header from all relevant... X-Git-Tag: BumpSslServerFirst.take05~12^2~120^2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00a7574ee43c0bf61f6313585292ebd19c58993c;p=thirdparty%2Fsquid.git Moved StatHist class to its own header-file, included the header from all relevant places. --- diff --git a/src/CacheDigest.cc b/src/CacheDigest.cc index 0830c480f6..9f649cd5f2 100644 --- a/src/CacheDigest.cc +++ b/src/CacheDigest.cc @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "StatHist.h" #include "Store.h" #if USE_CACHE_DIGESTS diff --git a/src/HttpHdrCc.cc b/src/HttpHdrCc.cc index 43dc2510ce..a913c9dc51 100644 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@ -32,9 +32,10 @@ #include "squid.h" #include "base/StringArea.h" -#include "Store.h" #include "HttpHeader.h" #include "HttpHdrCc.h" +#include "StatHist.h" +#include "Store.h" #if HAVE_MAP #include diff --git a/src/HttpHdrScTarget.cc b/src/HttpHdrScTarget.cc index 8b2f12a0c7..1639ccb76e 100644 --- a/src/HttpHdrScTarget.cc +++ b/src/HttpHdrScTarget.cc @@ -37,6 +37,7 @@ #include "squid.h" #include "HttpHdrSc.h" +#include "StatHist.h" extern http_hdr_sc_type &operator++ (http_hdr_sc_type &aHeader); /* copies non-extant fields from new_sc to this sc */ diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 68a844ec98..ab9cdc44f1 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -42,6 +42,7 @@ #include "MemBuf.h" #include "mgr/Registration.h" #include "rfc1123.h" +#include "StatHist.h" #include "Store.h" #include "TimeOrTag.h" diff --git a/src/Makefile.am b/src/Makefile.am index a981692874..4eaea62a39 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -424,6 +424,7 @@ squid_SOURCES = \ SquidMath.cc \ SquidNew.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ String.cc \ stmem.cc \ @@ -1080,6 +1081,7 @@ tests_testHttpReply_SOURCES=\ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ + StatHist.h \ tests/stub_StatHist.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ @@ -1156,6 +1158,7 @@ tests_testACLMaxUserIP_SOURCES= \ Packer.cc \ Parsing.cc \ SquidMath.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ String.cc \ @@ -1353,6 +1356,7 @@ tests_testCacheManager_SOURCES = \ SquidMath.h \ SquidMath.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -1475,6 +1479,7 @@ tests_testDiskIO_SOURCES = \ Parsing.cc \ refresh.cc \ RemovalPolicy.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ StoreFileSystem.cc \ @@ -1678,6 +1683,7 @@ tests_testEvent_SOURCES = \ SquidMath.cc \ SquidMath.h \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -1867,6 +1873,7 @@ tests_testEventLoop_SOURCES = \ SquidMath.h \ SquidMath.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -2052,6 +2059,7 @@ tests_test_http_range_SOURCES = \ SquidMath.h \ SquidMath.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -2276,6 +2284,7 @@ tests_testHttpRequest_SOURCES = \ SquidMath.h \ SquidMath.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -2390,6 +2399,7 @@ tests_testStore_SOURCES= \ Parsing.cc \ RemovalPolicy.cc \ refresh.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -2621,6 +2631,7 @@ tests_testUfs_SOURCES = \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ + StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ ETag.cc \ @@ -2713,6 +2724,7 @@ tests_testRock_SOURCES = \ Packer.cc \ Parsing.cc \ RemovalPolicy.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ @@ -2880,6 +2892,7 @@ tests_testCoss_SOURCES = \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ + StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ ETag.cc \ @@ -3014,6 +3027,7 @@ tests_testNull_SOURCES = \ HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ + StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ ETag.cc \ @@ -3163,6 +3177,7 @@ tests_testURL_SOURCES = \ SquidMath.h \ SquidMath.cc \ stat.cc \ + StatHist.h \ StatHist.cc \ stmem.cc \ store.cc \ diff --git a/src/StatHist.cc b/src/StatHist.cc index 6b82e9bfd5..4d60b4e7f8 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -46,6 +46,7 @@ */ #include "squid.h" +#include "StatHist.h" #include "Store.h" /* Local functions */ diff --git a/src/StatHist.h b/src/StatHist.h new file mode 100644 index 0000000000..13ea6e7dd3 --- /dev/null +++ b/src/StatHist.h @@ -0,0 +1,67 @@ +/* + * 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 + */ + +#ifndef STATHIST_H_ +#define STATHIST_H_ + +/* + * "very generic" histogram; + * see important comments on hbase_f restrictions in StatHist.c + */ + +class StatHist { +public: + int *bins; + int capacity; + double min; + double max; + double scale; + hbase_f *val_in; /* e.g., log() for log-based histogram */ + hbase_f *val_out; /* e.g., exp() for log based histogram */ +}; + +/* StatHist */ +SQUIDCEXTERN void statHistClean(StatHist * H); +SQUIDCEXTERN void statHistCount(StatHist * H, double val); +SQUIDCEXTERN void statHistCopy(StatHist * Dest, const StatHist * Orig); +SQUIDCEXTERN void statHistSafeCopy(StatHist * Dest, const StatHist * Orig); +SQUIDCEXTERN double statHistDeltaMedian(const StatHist * A, const StatHist * B); +SQUIDCEXTERN double statHistDeltaPctile(const StatHist * A, const StatHist * B, double pctile); +SQUIDCEXTERN void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd); +SQUIDCEXTERN void statHistLogInit(StatHist * H, int capacity, double min, double max); +SQUIDCEXTERN void statHistEnumInit(StatHist * H, int last_enum); +SQUIDCEXTERN void statHistIntInit(StatHist * H, int n); +SQUIDCEXTERN StatHistBinDumper statHistEnumDumper; +SQUIDCEXTERN StatHistBinDumper statHistIntDumper; + + + + +#endif /* STATHIST_H_ */ diff --git a/src/client_side.cc b/src/client_side.cc index 2504571bf4..e4fe532061 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -117,6 +117,7 @@ #include "MemObject.h" #include "ProtoPort.h" #include "rfc1738.h" +#include "StatHist.h" #include "SquidTime.h" #if USE_SSL #include "ssl/context_storage.h" diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 8db2585e74..5c790ec206 100644 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@ -59,6 +59,7 @@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" #if HAVE_SYS_DEVPOLL_H diff --git a/src/comm/ModEpoll.cc b/src/comm/ModEpoll.cc index f19df2f2c7..51e6a86e80 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -60,6 +60,7 @@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" #define DEBUG_EPOLL 0 diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index cbb00bc971..ecc950ea84 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -41,6 +41,7 @@ #include "ICP.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" #if HAVE_POLL_H diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index d18feef2a7..a3a16ff97e 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -41,6 +41,7 @@ #include "mgr/Registration.h" #include "SquidTime.h" #include "Store.h" +#include "StatHist.h" #include "fde.h" static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */ diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 4763437949..dd8a8aeb1d 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -40,6 +40,7 @@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */ diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 39ee90b3fd..375b7e4ee3 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -38,6 +38,7 @@ #include "event.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" #include "wordlist.h" diff --git a/src/icp_v2.cc b/src/icp_v2.cc index e6437ee831..e3992f199a 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -46,6 +46,7 @@ #include "acl/Acl.h" #include "AccessLogEntry.h" #include "wordlist.h" +#include "StatHist.h" #include "SquidTime.h" #include "SwapDir.h" #include "icmp/net_db.h" diff --git a/src/ipcache.cc b/src/ipcache.cc index ce69f12572..97993d0b52 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -40,6 +40,7 @@ #include "ipcache.h" #include "mgr/Registration.h" #include "SquidTime.h" +#include "StatHist.h" #include "Store.h" #include "wordlist.h" diff --git a/src/protos.h b/src/protos.h index dd38345cbd..1df24fa033 100644 --- a/src/protos.h +++ b/src/protos.h @@ -222,6 +222,8 @@ SQUIDCEXTERN const char *httpMakeVaryMark(HttpRequest * request, HttpReply const #include "HttpStatusCode.h" SQUIDCEXTERN const char *httpStatusString(http_status status); +class StatHist; + /* Http Cache Control Header Field */ SQUIDCEXTERN void httpHdrCcInitModule(void); SQUIDCEXTERN void httpHdrCcCleanModule(void); @@ -400,21 +402,6 @@ SQUIDCEXTERN double statRequestHitMemoryRatio(int minutes); SQUIDCEXTERN double statRequestHitDiskRatio(int minutes); SQUIDCEXTERN double statByteHitRatio(int minutes); -/* StatHist */ -SQUIDCEXTERN void statHistClean(StatHist * H); -SQUIDCEXTERN void statHistCount(StatHist * H, double val); -SQUIDCEXTERN void statHistCopy(StatHist * Dest, const StatHist * Orig); -SQUIDCEXTERN void statHistSafeCopy(StatHist * Dest, const StatHist * Orig); -SQUIDCEXTERN double statHistDeltaMedian(const StatHist * A, const StatHist * B); -SQUIDCEXTERN double statHistDeltaPctile(const StatHist * A, const StatHist * B, double pctile); -SQUIDCEXTERN void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd); -SQUIDCEXTERN void statHistLogInit(StatHist * H, int capacity, double min, double max); -SQUIDCEXTERN void statHistEnumInit(StatHist * H, int last_enum); -SQUIDCEXTERN void statHistIntInit(StatHist * H, int n); -SQUIDCEXTERN StatHistBinDumper statHistEnumDumper; -SQUIDCEXTERN StatHistBinDumper statHistIntDumper; - - /* mem */ SQUIDCEXTERN void memClean(void); SQUIDCEXTERN void memInitModule(void); diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 4dd122e29f..db88c5976c 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -36,6 +36,7 @@ #include "cache_snmp.h" #include "Store.h" #include "mem_node.h" +#include "StatHist.h" #include "SquidMath.h" #include "SquidTime.h" diff --git a/src/stat.cc b/src/stat.cc index be507e01b1..b7d617103a 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -54,6 +54,7 @@ #include "MemBuf.h" #include "SquidMath.h" #include "SquidTime.h" +#include "StatHist.h" #include "mgr/CountersAction.h" #include "mgr/FunAction.h" #include "mgr/InfoAction.h" diff --git a/src/structs.h b/src/structs.h index 49e16e9ae1..d398e95485 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1099,26 +1099,13 @@ struct _refresh_t { int max_stale; }; -/* - * "very generic" histogram; - * see important comments on hbase_f restrictions in StatHist.c - */ - -struct _StatHist { - int *bins; - int capacity; - double min; - double max; - double scale; - hbase_f *val_in; /* e.g., log() for log-based histogram */ - hbase_f *val_out; /* e.g., exp() for log based histogram */ -}; - /* * if you add a field to StatCounters, * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy */ +#include "StatHist.h" + struct _StatCounters { struct { diff --git a/src/tests/stub_StatHist.cc b/src/tests/stub_StatHist.cc index 9bcc5857f1..330bba5f20 100644 --- a/src/tests/stub_StatHist.cc +++ b/src/tests/stub_StatHist.cc @@ -1,7 +1,7 @@ #include "squid.h" // for StatHist definitions -#include "protos.h" +#include "StatHist.h" void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd) diff --git a/src/typedefs.h b/src/typedefs.h index 6b3f2164b7..dca39340a9 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -92,8 +92,6 @@ typedef struct _StatCounters StatCounters; typedef struct _storeSwapLogData storeSwapLogData; -typedef struct _StatHist StatHist; - typedef struct _cd_guess_stats cd_guess_stats; typedef struct _CacheDigest CacheDigest;