]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreStats.cc
6541542b19d41c5390c51b78c221b3cc917c0f4c
4 * DEBUG: section 20 Storage Manager Statistics
9 #include "protos.h" /* for xmemset only */
10 #include "StoreStats.h"
15 StoreInfoStats::StoreInfoStats()
17 xmemset(this, 0, sizeof(*this));
21 StoreInfoStats::operator +=(const StoreInfoStats
&stats
)
23 swap
.size
+= stats
.swap
.size
;
24 swap
.capacity
+= stats
.swap
.capacity
;
25 swap
.count
+= stats
.swap
.count
;
26 swap
.open_disk_fd
+= stats
.swap
.open_disk_fd
;
28 // Assume that either all workers use shared memory cache or none do.
29 // It is possible but difficult to report correct stats for an arbitrary
30 // mix, and only rather unusual deployments can benefit from mixing.
32 // If workers share memory, we will get shared stats from those workers
33 // and non-shared stats from other processes. Ignore order and also
34 // ignore other processes stats because they are zero in most setups.
35 if (stats
.mem
.shared
) { // workers share memory
36 // use the latest reported stats, they all should be about the same
38 mem
.size
= stats
.mem
.size
;
39 mem
.capacity
= stats
.mem
.capacity
;
40 mem
.count
= stats
.mem
.count
;
41 } else if (!mem
.shared
) { // do not corrupt shared stats, if any
42 // workers do not share so we must add everything up
43 mem
.size
+= stats
.mem
.size
;
44 mem
.capacity
+= stats
.mem
.capacity
;
45 mem
.count
+= stats
.mem
.count
;
48 store_entry_count
+= stats
.store_entry_count
;
49 mem_object_count
+= stats
.mem_object_count
;
58 StoreIoStats::StoreIoStats()
60 xmemset(this, 0, sizeof(*this));