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