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