]>
Commit | Line | Data |
---|---|---|
e1656dc4 | 1 | /* |
1f7b830e | 2 | * Copyright (C) 1996-2025 The Squid Software Foundation and contributors |
e1656dc4 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
e1656dc4 | 7 | */ |
bbc27441 | 8 | |
ff9d9458 FC |
9 | #ifndef SQUID_SRC_STATCOUNTERS_H |
10 | #define SQUID_SRC_STATCOUNTERS_H | |
e1656dc4 | 11 | |
a0864754 | 12 | #include "base/ByteCounter.h" |
17c0af35 | 13 | #include "comm/Incoming.h" |
e1656dc4 FC |
14 | #include "StatHist.h" |
15 | ||
16 | #if USE_CACHE_DIGESTS | |
e8baef82 | 17 | /** statistics for cache digests and other hit "predictors" */ |
75fbab53 A |
18 | class CacheDigestGuessStats |
19 | { | |
e1656dc4 | 20 | public: |
b56b37cf AJ |
21 | int trueHits = 0; |
22 | int falseHits = 0; | |
23 | int trueMisses = 0; | |
24 | int falseMisses = 0; | |
e1656dc4 FC |
25 | }; |
26 | #endif | |
27 | ||
e8baef82 FC |
28 | /** General collection of process-wide statistics. |
29 | * | |
b56b37cf AJ |
30 | * \note if you add a field to StatCounters which requires any non-trivial |
31 | * initialization or copy you MUST sync statCountersInitSpecial() | |
e1656dc4 | 32 | */ |
75fbab53 A |
33 | class StatCounters |
34 | { | |
e1656dc4 | 35 | public: |
b56b37cf AJ |
36 | StatCounters() : timestamp(current_time) {} |
37 | ||
e1656dc4 | 38 | struct { |
b56b37cf AJ |
39 | int clients = 0; |
40 | int requests = 0; | |
41 | int hits = 0; | |
42 | int mem_hits = 0; | |
43 | int disk_hits = 0; | |
44 | int errors = 0; | |
a0864754 AJ |
45 | ByteCounter kbytes_in; |
46 | ByteCounter kbytes_out; | |
47 | ByteCounter hit_kbytes_out; | |
e8baef82 FC |
48 | StatHist missSvcTime; |
49 | StatHist nearMissSvcTime; | |
50 | StatHist nearHitSvcTime; | |
51 | StatHist hitSvcTime; | |
52 | StatHist allSvcTime; | |
e1656dc4 FC |
53 | } client_http; |
54 | ||
55 | struct { | |
56 | ||
57 | struct { | |
b56b37cf AJ |
58 | int requests = 0; |
59 | int errors = 0; | |
a0864754 AJ |
60 | ByteCounter kbytes_in; |
61 | ByteCounter kbytes_out; | |
9e167fa2 | 62 | } all, http, ftp, other; |
e1656dc4 FC |
63 | } server; |
64 | ||
65 | struct { | |
b56b37cf AJ |
66 | int pkts_sent = 0; |
67 | int queries_sent = 0; | |
68 | int replies_sent = 0; | |
69 | int pkts_recv = 0; | |
70 | int queries_recv = 0; | |
71 | int replies_recv = 0; | |
72 | int hits_sent = 0; | |
73 | int hits_recv = 0; | |
74 | int replies_queued = 0; | |
75 | int replies_dropped = 0; | |
a0864754 AJ |
76 | ByteCounter kbytes_sent; |
77 | ByteCounter q_kbytes_sent; | |
78 | ByteCounter r_kbytes_sent; | |
79 | ByteCounter kbytes_recv; | |
80 | ByteCounter q_kbytes_recv; | |
81 | ByteCounter r_kbytes_recv; | |
e8baef82 FC |
82 | StatHist querySvcTime; |
83 | StatHist replySvcTime; | |
b56b37cf AJ |
84 | int query_timeouts = 0; |
85 | int times_used = 0; | |
e1656dc4 FC |
86 | } icp; |
87 | ||
88 | struct { | |
b56b37cf AJ |
89 | int pkts_sent = 0; |
90 | int pkts_recv = 0; | |
e1656dc4 FC |
91 | } htcp; |
92 | ||
93 | struct { | |
b56b37cf | 94 | int requests = 0; |
e1656dc4 FC |
95 | } unlink; |
96 | ||
97 | struct { | |
e8baef82 | 98 | StatHist svcTime; |
e1656dc4 FC |
99 | } dns; |
100 | ||
101 | struct { | |
b56b37cf | 102 | int times_used = 0; |
a0864754 AJ |
103 | ByteCounter kbytes_sent; |
104 | ByteCounter kbytes_recv; | |
105 | ByteCounter memory; | |
b56b37cf AJ |
106 | int msgs_sent = 0; |
107 | int msgs_recv = 0; | |
e1656dc4 | 108 | #if USE_CACHE_DIGESTS |
e8baef82 | 109 | CacheDigestGuessStats guess; |
e1656dc4 | 110 | #endif |
e1656dc4 FC |
111 | StatHist on_xition_count; |
112 | } cd; | |
113 | ||
114 | struct { | |
b56b37cf | 115 | int times_used = 0; |
e1656dc4 | 116 | } netdb; |
b56b37cf AJ |
117 | int page_faults = 0; |
118 | unsigned long int select_loops = 0; | |
119 | int select_fds = 0; | |
120 | double select_time = 0.0; | |
121 | double cputime = 0.0; | |
e1656dc4 FC |
122 | |
123 | struct timeval timestamp; | |
17c0af35 AJ |
124 | #if USE_POLL || USE_SELECT |
125 | Comm::Incoming comm_dns; | |
126 | Comm::Incoming comm_tcp; | |
127 | Comm::Incoming comm_udp; | |
128 | #endif | |
e1656dc4 FC |
129 | StatHist select_fds_hist; |
130 | ||
131 | struct { | |
132 | struct { | |
b56b37cf AJ |
133 | int opens = 0; |
134 | int closes = 0; | |
135 | int reads = 0; | |
136 | int writes = 0; | |
137 | int seeks = 0; | |
138 | int unlinks = 0; | |
e1656dc4 FC |
139 | } disk; |
140 | ||
141 | struct { | |
b56b37cf AJ |
142 | int accepts = 0; |
143 | int sockets = 0; | |
144 | int connects = 0; | |
145 | int binds = 0; | |
146 | int closes = 0; | |
147 | int reads = 0; | |
148 | int writes = 0; | |
149 | int recvfroms = 0; | |
150 | int sendtos = 0; | |
e1656dc4 | 151 | } sock; |
b56b37cf | 152 | int selects = 0; |
e1656dc4 | 153 | } syscalls; |
b56b37cf | 154 | int aborted_requests = 0; |
e1656dc4 FC |
155 | |
156 | struct { | |
b56b37cf AJ |
157 | int files_cleaned = 0; |
158 | int outs = 0; | |
159 | int ins = 0; | |
e1656dc4 | 160 | } swap; |
b2aca62a EB |
161 | |
162 | struct { | |
163 | uint64_t attempts = 0; | |
164 | uint64_t refusalsDueToLocking = 0; | |
165 | uint64_t refusalsDueToZeroSize = 0; | |
166 | uint64_t refusalsDueToTimeLimit = 0; | |
167 | uint64_t failures = 0; | |
168 | } hitValidation; | |
169 | ||
e1656dc4 FC |
170 | }; |
171 | ||
e4f1fdae | 172 | extern StatCounters statCounter; |
e1656dc4 | 173 | |
ff9d9458 | 174 | #endif /* SQUID_SRC_STATCOUNTERS_H */ |
f53969cc | 175 |