]> git.ipfire.org Git - thirdparty/squid.git/blame - src/StoreStats.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / StoreStats.h
CommitLineData
bbc27441 1/*
ef57eb7b 2 * Copyright (C) 1996-2016 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
AR
19 public:
20 double size; ///< bytes currently in use
21 double count; ///< number of cached objects
22 double capacity; ///< the size limit
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
AR
34 public:
35 double open_disk_fd; ///< number of opened disk files
36 };
37
38 /// memory cache (cache_mem) storage stats
a46ed03b
AR
39 class Mem: public Part
40 {
93bc1434
AR
41 public:
42 bool shared; ///< whether memory cache is shared among workers
43 };
44
93bc1434
AR
45 StoreInfoStats();
46 StoreInfoStats &operator +=(const StoreInfoStats &stats);
47
93bc1434
AR
48 Swap swap; ///< cache_mem stats
49 Mem mem; ///< all cache_dirs stats
50
51 /* stats that could be shared by memory and disk storage */
52 double store_entry_count; ///< number of StoreEntry objects in existence
53 double mem_object_count; ///< number of MemObject objects in existence
54};
55
56// TODO: this should be adjusted for use in StoreIoActionData, DiskdActionData
57/// Store statistics related to low-level I/O.
a46ed03b
AR
58class StoreIoStats
59{
93bc1434
AR
60public:
61 StoreIoStats();
62
63 struct {
64 int calls;
65 int select_fail;
66 int create_fail;
67 int success;
68 } create; ///< cache_dir selection and disk entry creation stats
69};
70
71#endif /* SQUID_STORE_STATS_H */
f53969cc 72