]> git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreStats.h
SMP shared memory cache stats were not collected.
[thirdparty/squid.git] / src / StoreStats.h
1 #ifndef SQUID_STORE_STATS_H
2 #define SQUID_STORE_STATS_H
3
4 /// High-level store statistics used by mgr:info action. Used inside PODs!
5 class StoreInfoStats {
6 public:
7 /// Info common to memory and disk parts of the storage. Used inside PODs!
8 class Part {
9 public:
10 double size; ///< bytes currently in use
11 double count; ///< number of cached objects
12 double capacity; ///< the size limit
13
14 /// mean size of a cached object
15 double meanObjectSize() const { return count > 0 ? size/count : 0.0; }
16
17 /// number of unused bytes
18 double available() const { return capacity - size; }
19 };
20
21 /// disk cache (all cache_dirs) storage stats
22 class Swap: public Part {
23 public:
24 double open_disk_fd; ///< number of opened disk files
25 };
26
27 /// memory cache (cache_mem) storage stats
28 class Mem: public Part {
29 public:
30 bool shared; ///< whether memory cache is shared among workers
31 };
32
33
34 StoreInfoStats();
35 StoreInfoStats &operator +=(const StoreInfoStats &stats);
36
37
38 Swap swap; ///< cache_mem stats
39 Mem mem; ///< all cache_dirs stats
40
41 /* stats that could be shared by memory and disk storage */
42 double store_entry_count; ///< number of StoreEntry objects in existence
43 double mem_object_count; ///< number of MemObject objects in existence
44 };
45
46 // TODO: this should be adjusted for use in StoreIoActionData, DiskdActionData
47 /// Store statistics related to low-level I/O.
48 class StoreIoStats {
49 public:
50 StoreIoStats();
51
52 struct {
53 int calls;
54 int select_fail;
55 int create_fail;
56 int success;
57 } create; ///< cache_dir selection and disk entry creation stats
58 };
59
60 #endif /* SQUID_STORE_STATS_H */