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