From: Francesco Chemolli Date: Fri, 9 Dec 2011 20:45:55 +0000 (+0100) Subject: Put HttpHeaderStat, StatCounters and cd_guess_stats classes in their own headers. X-Git-Tag: BumpSslServerFirst.take05~12^2~120^2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e1656dc40f5cca0c2b63e0c3d0af0cd5fdbad283;p=thirdparty%2Fsquid.git Put HttpHeaderStat, StatCounters and cd_guess_stats classes in their own headers. --- e1656dc40f5cca0c2b63e0c3d0af0cd5fdbad283 diff --cc src/HttpHdrCc.cc index 1939ad66ad,1939ad66ad..211402e652 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@@ -33,6 -33,6 +33,7 @@@ #include "squid.h" #include "base/StringArea.h" #include "HttpHeader.h" ++#include "HttpHeaderStat.h" #include "HttpHdrCc.h" #include "StatHist.h" #include "Store.h" diff --cc src/HttpHdrSc.cc index 7812b1dfd1,7812b1dfd1..bf46d1ead8 --- a/src/HttpHdrSc.cc +++ b/src/HttpHdrSc.cc @@@ -39,6 -39,6 +39,7 @@@ #include "squid.h" #include "Store.h" #include "HttpHeader.h" ++#include "HttpHeaderStat.h" #include "HttpHdrSc.h" #if HAVE_MAP diff --cc src/HttpHeader.cc index bb61b5e0c6,bb61b5e0c6..9d039ba37a --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@@ -39,6 -39,6 +39,7 @@@ #include "HttpHdrCc.h" #include "HttpHdrSc.h" #include "HttpHeader.h" ++#include "HttpHeaderStat.h" #include "MemBuf.h" #include "mgr/Registration.h" #include "rfc1123.h" diff --cc src/HttpHeaderStat.h index 0000000000,0000000000..9ebdd3f457 new file mode 100644 --- /dev/null +++ b/src/HttpHeaderStat.h @@@ -1,0 -1,0 +1,32 @@@ ++/* ++ * HttpHeaderStat.h ++ * ++ * Created on: Dec 9, 2011 ++ * Author: kinkie ++ */ ++ ++#ifndef HTTPHEADERSTAT_H_ ++#define HTTPHEADERSTAT_H_ ++ ++/* per header statistics */ ++ ++#include "StatHist.h" ++class HttpHeaderStat { ++public: ++ const char *label; ++ HttpHeaderMask *owner_mask; ++ ++ StatHist hdrUCountDistr; ++ StatHist fieldTypeDistr; ++ StatHist ccTypeDistr; ++ StatHist scTypeDistr; ++ ++ int parsedCount; ++ int ccParsedCount; ++ int scParsedCount; ++ int destroyedCount; ++ int busyDestroyedCount; ++}; ++ ++ ++#endif /* HTTPHEADERSTAT_H_ */ diff --cc src/Makefile.am index 4eaea62a39,4eaea62a39..a489addf57 --- a/src/Makefile.am +++ b/src/Makefile.am @@@ -353,6 -353,6 +353,7 @@@ squid_SOURCES = HttpHdrScTarget.h \ HttpHdrContRange.cc \ HttpHdrContRange.h \ ++ HttpHeaderStat.h \ HttpHeader.cc \ HttpHeader.h \ HttpHeaderMask.h \ @@@ -424,6 -424,6 +425,7 @@@ SquidMath.cc \ SquidNew.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ String.cc \ @@@ -1081,6 -1081,6 +1083,7 @@@ tests_testHttpReply_SOURCES= tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ ++ StatCounters.h \ StatHist.h \ tests/stub_StatHist.cc \ tests/stub_store.cc \ @@@ -1158,6 -1158,6 +1161,7 @@@ tests_testACLMaxUserIP_SOURCES= Packer.cc \ Parsing.cc \ SquidMath.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -1356,6 -1356,6 +1360,7 @@@ tests_testCacheManager_SOURCES = SquidMath.h \ SquidMath.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -1479,6 -1479,6 +1484,7 @@@ tests_testDiskIO_SOURCES = Parsing.cc \ refresh.cc \ RemovalPolicy.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -1683,6 -1683,6 +1689,7 @@@ tests_testEvent_SOURCES = SquidMath.cc \ SquidMath.h \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -1873,6 -1873,6 +1880,7 @@@ tests_testEventLoop_SOURCES = SquidMath.h \ SquidMath.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -2059,6 -2059,6 +2067,7 @@@ tests_test_http_range_SOURCES = SquidMath.h \ SquidMath.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -2284,6 -2284,6 +2293,7 @@@ tests_testHttpRequest_SOURCES = SquidMath.h \ SquidMath.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -2399,6 -2399,6 +2409,7 @@@ tests_testStore_SOURCES= Parsing.cc \ RemovalPolicy.cc \ refresh.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -2631,6 -2631,6 +2642,7 @@@ tests_testUfs_SOURCES = HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ @@@ -2724,6 -2724,6 +2736,7 @@@ tests_testRock_SOURCES = Packer.cc \ Parsing.cc \ RemovalPolicy.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ @@@ -2892,6 -2892,6 +2905,7 @@@ tests_testCoss_SOURCES = HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ @@@ -3027,6 -3027,6 +3041,7 @@@ tests_testNull_SOURCES = HttpHdrSc.cc \ HttpHdrScTarget.cc \ url.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ HttpHdrRange.cc \ @@@ -3177,6 -3177,6 +3192,7 @@@ tests_testURL_SOURCES = SquidMath.h \ SquidMath.cc \ stat.cc \ ++ StatCounters.h \ StatHist.h \ StatHist.cc \ stmem.cc \ diff --cc src/StatCounters.h index 0000000000,0000000000..f871338a8b new file mode 100644 --- /dev/null +++ b/src/StatCounters.h @@@ -1,0 -1,0 +1,162 @@@ ++/* ++ * StatCounters.h ++ * ++ * Created on: Dec 9, 2011 ++ * Author: kinkie ++ */ ++ ++#ifndef STATCOUNTERS_H_ ++#define STATCOUNTERS_H_ ++ ++#include "config.h" ++ ++#include "StatHist.h" ++ ++#if USE_CACHE_DIGESTS ++/* statistics for cache digests and other hit "predictors" */ ++class cd_guess_stats { ++public: ++ /* public, read-only */ ++ int true_hits; ++ int false_hits; ++ int true_misses; ++ int false_misses; ++ int close_hits; /* tmp, remove it later */ ++}; ++#endif ++ ++ ++/* ++ * if you add a field to StatCounters, ++ * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy ++ */ ++class StatCounters { ++public: ++ ++ struct { ++ int clients; ++ int requests; ++ int hits; ++ int mem_hits; ++ int disk_hits; ++ int errors; ++ kb_t kbytes_in; ++ kb_t kbytes_out; ++ kb_t hit_kbytes_out; ++ StatHist miss_svc_time; ++ StatHist nm_svc_time; ++ StatHist nh_svc_time; ++ StatHist hit_svc_time; ++ StatHist all_svc_time; ++ } client_http; ++ ++ struct { ++ ++ struct { ++ int requests; ++ int errors; ++ kb_t kbytes_in; ++ kb_t kbytes_out; ++ } all , http, ftp, other; ++ } server; ++ ++ struct { ++ int pkts_sent; ++ int queries_sent; ++ int replies_sent; ++ int pkts_recv; ++ int queries_recv; ++ int replies_recv; ++ int hits_sent; ++ int hits_recv; ++ int replies_queued; ++ int replies_dropped; ++ kb_t kbytes_sent; ++ kb_t q_kbytes_sent; ++ kb_t r_kbytes_sent; ++ kb_t kbytes_recv; ++ kb_t q_kbytes_recv; ++ kb_t r_kbytes_recv; ++ StatHist query_svc_time; ++ StatHist reply_svc_time; ++ int query_timeouts; ++ int times_used; ++ } icp; ++ ++ struct { ++ int pkts_sent; ++ int pkts_recv; ++ } htcp; ++ ++ struct { ++ int requests; ++ } unlink; ++ ++ struct { ++ StatHist svc_time; ++ } dns; ++ ++ struct { ++ int times_used; ++ kb_t kbytes_sent; ++ kb_t kbytes_recv; ++ kb_t memory; ++ int msgs_sent; ++ int msgs_recv; ++#if USE_CACHE_DIGESTS ++ ++ cd_guess_stats guess; ++#endif ++ ++ StatHist on_xition_count; ++ } cd; ++ ++ struct { ++ int times_used; ++ } netdb; ++ int page_faults; ++ unsigned long int select_loops; ++ int select_fds; ++ double select_time; ++ double cputime; ++ ++ struct timeval timestamp; ++ StatHist comm_icp_incoming; ++ StatHist comm_dns_incoming; ++ StatHist comm_http_incoming; ++ StatHist select_fds_hist; ++ ++ struct { ++ struct { ++ int opens; ++ int closes; ++ int reads; ++ int writes; ++ int seeks; ++ int unlinks; ++ } disk; ++ ++ struct { ++ int accepts; ++ int sockets; ++ int connects; ++ int binds; ++ int closes; ++ int reads; ++ int writes; ++ int recvfroms; ++ int sendtos; ++ } sock; ++ int selects; ++ } syscalls; ++ int aborted_requests; ++ ++ struct { ++ int files_cleaned; ++ int outs; ++ int ins; ++ } swap; ++}; ++ ++ ++#endif /* STATCOUNTERS_H_ */ diff --cc src/StatHist.h index ee3258116a,e128b4a48e..8afd5b605a --- a/src/StatHist.h +++ b/src/StatHist.h @@@ -32,6 -32,6 +32,7 @@@ #define STATHIST_H_ #include "config.h" ++#include "typedefs.h" /* * "very generic" histogram; diff --cc src/client_side.cc index 069bbeb66f,069bbeb66f..f134d88dee --- a/src/client_side.cc +++ b/src/client_side.cc @@@ -117,6 -117,6 +117,7 @@@ #include "MemObject.h" #include "ProtoPort.h" #include "rfc1738.h" ++#include "StatCounters.h" #include "StatHist.h" #include "SquidTime.h" #if USE_SSL diff --cc src/comm/ModDevPoll.cc index ab39bb00de,ab39bb00de..6b926336e6 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@@ -59,6 -59,6 +59,7 @@@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" ++#include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --cc src/comm/ModEpoll.cc index c0e0c770fe,c0e0c770fe..3e53cce0a0 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@@ -60,6 -60,6 +60,7 @@@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" ++#include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --cc src/comm/ModPoll.cc index 8004d33eae,8004d33eae..b190500dff --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@@ -652,11 -652,11 +652,11 @@@ commIncomingStats(StoreEntry * sentry storeAppendPrintf(sentry, "\n"); storeAppendPrintf(sentry, "Histogram of events per incoming socket type\n"); storeAppendPrintf(sentry, "ICP Messages handled per comm_poll_icp_incoming() call:\n"); -- statHistDump(&f->comm_icp_incoming, sentry, statHistIntDumper); ++ f->comm_icp_incoming.dump(sentry, statHistIntDumper); storeAppendPrintf(sentry, "DNS Messages handled per comm_poll_dns_incoming() call:\n"); -- statHistDump(&f->comm_dns_incoming, sentry, statHistIntDumper); ++ f->comm_dns_incoming.dump(sentry, statHistIntDumper); storeAppendPrintf(sentry, "HTTP Messages handled per comm_poll_http_incoming() call:\n"); -- statHistDump(&f->comm_http_incoming, sentry, statHistIntDumper); ++ f->comm_http_incoming.dump(sentry, statHistIntDumper); } /* Called by async-io or diskd to speed up the polling */ diff --cc src/comm/ModSelect.cc index c4eda9956c,c4eda9956c..b3bc1b8350 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@@ -40,8 -40,8 +40,9 @@@ #include "ICP.h" #include "mgr/Registration.h" #include "SquidTime.h" --#include "Store.h" ++#include "StatCounters.h" #include "StatHist.h" ++#include "Store.h" #include "fde.h" static int MAX_POLL_TIME = 1000; /* see also Comm::QuickPollRequired() */ diff --cc src/comm/ModSelectWin32.cc index 1c31c59542,1c31c59542..42c05af577 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@@ -40,6 -40,6 +40,7 @@@ #include "fde.h" #include "mgr/Registration.h" #include "SquidTime.h" ++#include "StatCounters.h" #include "StatHist.h" #include "Store.h" diff --cc src/globals.h index c20e713b5e,c20e713b5e..104b3ecc02 --- a/src/globals.h +++ b/src/globals.h @@@ -41,7 -41,7 +41,8 @@@ /* for ERROR_BUF_SZ, BUFSIZ, MAXHTTPPORTS */ #include "defines.h" --/* for iostats, StatCounters */ ++#include "StatCounters.h" ++/* for iostats */ #include "structs.h" diff --cc src/protos.h index 1df24fa033,1df24fa033..cc5e1118cf --- a/src/protos.h +++ b/src/protos.h @@@ -625,7 -625,7 +625,7 @@@ SQUIDCEXTERN pid_t ipcCreate(int type int *wfd, void **hIpc); -- ++class cd_guess_stats; /* CacheDigest */ SQUIDCEXTERN CacheDigest *cacheDigestCreate(int capacity, int bpe); SQUIDCEXTERN void cacheDigestDestroy(CacheDigest * cd); @@@ -682,6 -682,6 +682,7 @@@ SQUIDCEXTERN int gethostname(char *, in /* * hack to allow snmp access to the statistics counters */ ++class StatCounters; SQUIDCEXTERN StatCounters *snmpStatGet(int); /* Vary support functions */ diff --cc src/snmp_agent.cc index ca15da8353,ca15da8353..6e8527b9b0 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@@ -36,6 -36,6 +36,7 @@@ #include "cache_snmp.h" #include "Store.h" #include "mem_node.h" ++#include "StatCounters.h" #include "StatHist.h" #include "SquidMath.h" #include "SquidTime.h" diff --cc src/structs.h index 5dd8ae1749,d398e95485..9a95146118 --- a/src/structs.h +++ b/src/structs.h @@@ -772,21 -772,21 +772,6 @@@ struct _domain_type domain_type *next; }; --#if USE_CACHE_DIGESTS -- --/* statistics for cache digests and other hit "predictors" */ -- --struct _cd_guess_stats { -- /* public, read-only */ -- int true_hits; -- int false_hits; -- int true_misses; -- int false_misses; -- int close_hits; /* tmp, remove it later */ --}; -- --#endif -- class PeerDigest; struct peer { @@@ -1099,158 -1099,158 +1084,6 @@@ struct _refresh_t int max_stale; }; --/* -- * if you add a field to StatCounters, -- * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy -- */ -- --#include "StatHist.h" -- --struct _StatCounters { -- -- struct { -- int clients; -- int requests; -- int hits; -- int mem_hits; -- int disk_hits; -- int errors; -- kb_t kbytes_in; -- kb_t kbytes_out; -- kb_t hit_kbytes_out; - StatHistLog miss_svc_time(300, 0.0, 3600000.0 * 3.0); - StatHistLog nm_svc_time(300, 0.0, 3600000.0 * 3.0); - StatHistLog nh_svc_time(300, 0.0, 3600000.0 * 3.0); - StatHistLog hit_svc_time(300, 0.0, 3600000.0 * 3.0); - StatHistLog all_svc_time(300, 0.0, 3600000.0 * 3.0); - StatHist miss_svc_time; - StatHist nm_svc_time; - StatHist nh_svc_time; - StatHist hit_svc_time; - StatHist all_svc_time; -- } client_http; -- -- struct { -- -- struct { -- int requests; -- int errors; -- kb_t kbytes_in; -- kb_t kbytes_out; -- } all , http, ftp, other; -- } server; -- -- struct { -- int pkts_sent; -- int queries_sent; -- int replies_sent; -- int pkts_recv; -- int queries_recv; -- int replies_recv; -- int hits_sent; -- int hits_recv; -- int replies_queued; -- int replies_dropped; -- kb_t kbytes_sent; -- kb_t q_kbytes_sent; -- kb_t r_kbytes_sent; -- kb_t kbytes_recv; -- kb_t q_kbytes_recv; -- kb_t r_kbytes_recv; - StatHistLog query_svc_time(300, 0.0, 1000000.0 * 60.0); - StatHistLog reply_svc_time(300, 0.0, 1000000.0 * 60.0); - StatHist query_svc_time; - StatHist reply_svc_time; -- int query_timeouts; -- int times_used; -- } icp; -- -- struct { -- int pkts_sent; -- int pkts_recv; -- } htcp; -- -- struct { -- int requests; -- } unlink; -- -- struct { - StatHistLog svc_time(300, 0.0, 60000.0 * 10.0); - StatHist svc_time; -- } dns; -- -- struct { -- int times_used; -- kb_t kbytes_sent; -- kb_t kbytes_recv; -- kb_t memory; -- int msgs_sent; -- int msgs_recv; --#if USE_CACHE_DIGESTS -- -- cd_guess_stats guess; --#endif -- -- StatHist on_xition_count; -- } cd; -- -- struct { -- int times_used; -- } netdb; -- int page_faults; -- unsigned long int select_loops; -- int select_fds; -- double select_time; -- double cputime; -- -- struct timeval timestamp; -- StatHist comm_icp_incoming; -- StatHist comm_dns_incoming; -- StatHist comm_http_incoming; -- StatHist select_fds_hist; -- -- struct { -- struct { -- int opens; -- int closes; -- int reads; -- int writes; -- int seeks; -- int unlinks; -- } disk; -- -- struct { -- int accepts; -- int sockets; -- int connects; -- int binds; -- int closes; -- int reads; -- int writes; -- int recvfroms; -- int sendtos; -- } sock; -- int selects; -- } syscalls; -- int aborted_requests; -- -- struct { -- int files_cleaned; -- int outs; -- int ins; -- } swap; --}; -- --/* per header statistics */ -- --struct _HttpHeaderStat { -- const char *label; -- HttpHeaderMask *owner_mask; -- -- StatHist hdrUCountDistr; -- StatHist fieldTypeDistr; -- StatHist ccTypeDistr; -- StatHist scTypeDistr; -- -- int parsedCount; -- int ccParsedCount; -- int scParsedCount; -- int destroyedCount; -- int busyDestroyedCount; --}; -- struct _CacheDigest { /* public, read-only */ diff --cc src/typedefs.h index dca39340a9,dca39340a9..aa6bc49149 --- a/src/typedefs.h +++ b/src/typedefs.h @@@ -60,8 -60,8 +60,6 @@@ typedef struct _fileMap fileMap typedef struct _HttpHeaderFieldAttrs HttpHeaderFieldAttrs; --typedef struct _HttpHeaderStat HttpHeaderStat; -- typedef struct _domain_ping domain_ping; typedef struct _domain_type domain_type; @@@ -88,12 -88,12 +86,8 @@@ typedef struct _refresh_t refresh_t typedef struct _CommWriteStateData CommWriteStateData; --typedef struct _StatCounters StatCounters; -- typedef struct _storeSwapLogData storeSwapLogData; --typedef struct _cd_guess_stats cd_guess_stats; -- typedef struct _CacheDigest CacheDigest; typedef struct _Version Version;