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