]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Put HttpHeaderStat, StatCounters and cd_guess_stats classes in their own headers.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 9 Dec 2011 20:45:55 +0000 (21:45 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 9 Dec 2011 20:45:55 +0000 (21:45 +0100)
18 files changed:
1  2 
src/HttpHdrCc.cc
src/HttpHdrSc.cc
src/HttpHeader.cc
src/HttpHeaderStat.h
src/Makefile.am
src/StatCounters.h
src/StatHist.h
src/client_side.cc
src/comm/ModDevPoll.cc
src/comm/ModEpoll.cc
src/comm/ModPoll.cc
src/comm/ModSelect.cc
src/comm/ModSelectWin32.cc
src/globals.h
src/protos.h
src/snmp_agent.cc
src/structs.h
src/typedefs.h

index 1939ad66ad68ee518a0266bc6e2724dffac2727c,1939ad66ad68ee518a0266bc6e2724dffac2727c..211402e6526b19317d757e51d446a9bf9eb3066b
@@@ -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"
index 7812b1dfd191a0b7e7f2af12bfa97f316f82bd43,7812b1dfd191a0b7e7f2af12bfa97f316f82bd43..bf46d1ead8427288127ff847cce3d885181f3599
@@@ -39,6 -39,6 +39,7 @@@
  #include "squid.h"
  #include "Store.h"
  #include "HttpHeader.h"
++#include "HttpHeaderStat.h"
  #include "HttpHdrSc.h"
  
  #if HAVE_MAP
index bb61b5e0c6c092c9bed63bb3780e37cbfd4256a4,bb61b5e0c6c092c9bed63bb3780e37cbfd4256a4..9d039ba37a9571313ec492246b19bf18b37858b0
@@@ -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"
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..9ebdd3f457d89ab61f90cc50698e72422fb6ea01
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -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 4eaea62a398ebf9ef3e28466e4c60ddd1ad6082e,4eaea62a398ebf9ef3e28466e4c60ddd1ad6082e..a489addf57dbb8e3fb9a1beae086751bec49539a
@@@ -353,6 -353,6 +353,7 @@@ squid_SOURCES = 
        HttpHdrScTarget.h \
        HttpHdrContRange.cc \
        HttpHdrContRange.h \
++      HttpHeaderStat.h \
        HttpHeader.cc \
        HttpHeader.h \
        HttpHeaderMask.h \
        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 \
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..f871338a8b2ea5c8c123281dca9452bd12001159
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -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 ee3258116aa4adac3b27a5847a8a237072d1a4dd,e128b4a48e8309790e6ad3cd93b490439523217f..8afd5b605aa3f98763f2ee87ee6a87ce1ac41c87
@@@ -32,6 -32,6 +32,7 @@@
  #define STATHIST_H_
  
  #include "config.h"
++#include "typedefs.h"
  
  /*
   * "very generic" histogram;
index 069bbeb66fdad14818f14f1d01e6e9df600f1515,069bbeb66fdad14818f14f1d01e6e9df600f1515..f134d88dee3575e08e9e7ec6e34acbdd55240ec8
  #include "MemObject.h"
  #include "ProtoPort.h"
  #include "rfc1738.h"
++#include "StatCounters.h"
  #include "StatHist.h"
  #include "SquidTime.h"
  #if USE_SSL
index ab39bb00def5fa1d1c2467003100d5efe4c3c6ed,ab39bb00def5fa1d1c2467003100d5efe4c3c6ed..6b926336e66e45732a76eef572f1173837c6a049
@@@ -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"
  
index c0e0c770fea77d278a92997e92d3da3ce705ec04,c0e0c770fea77d278a92997e92d3da3ce705ec04..3e53cce0a00c5e2d887bec336562ab65d506e676
@@@ -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"
  
index 8004d33eae9bb63c1803c4933e07ec072ab63eb9,8004d33eae9bb63c1803c4933e07ec072ab63eb9..b190500dff1fa42c67c64a8f9fa6fbd792b77a4c
@@@ -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 */
index c4eda9956ce0b21b4825d7726a003eae377ff615,c4eda9956ce0b21b4825d7726a003eae377ff615..b3bc1b83504f28eac0b3ad52dbb1d827c6f808a9
@@@ -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() */
index 1c31c5954227507a1db072fedee6861ff8046703,1c31c5954227507a1db072fedee6861ff8046703..42c05af5777666d927c3f08c08490034718b661d
@@@ -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 c20e713b5e0b2decd9dd7c35e13e9e349a15de0a,c20e713b5e0b2decd9dd7c35e13e9e349a15de0a..104b3ecc02482ec6b73e6492d60b33ae487c071b
@@@ -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 1df24fa0336a8f2ae8be7ccb5293fb2cf0b452b7,1df24fa0336a8f2ae8be7ccb5293fb2cf0b452b7..cc5e1118cf821bb250049228703f403a83d6360e
@@@ -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 */
index ca15da8353ff4e237bfe397b08b382cc7e1d5e83,ca15da8353ff4e237bfe397b08b382cc7e1d5e83..6e8527b9b05e5be6fe40c884a72e9a32e8fa304d
@@@ -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 5dd8ae17499aae0a8e2d3e956697eeea1cf2aae4,d398e95485c4722e3ad0222e2f03b8235f9492db..9a95146118eba5c57902e594eda6fd334eb3c6f8
@@@ -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 dca39340a960ef1b37b5365d2d523d9e4cd001f4,dca39340a960ef1b37b5365d2d523d9e4cd001f4..aa6bc49149d8c9144a4cd9255485e191e852adde
@@@ -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;