]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/InfoAction.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / mgr / InfoAction.h
1 /*
2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
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
9 /* DEBUG: section 16 Cache Manager API */
10
11 #ifndef SQUID_MGR_INFO_ACTION_H
12 #define SQUID_MGR_INFO_ACTION_H
13
14 #include "mgr/Action.h"
15 #include "StoreStats.h"
16
17 namespace Mgr
18 {
19
20 /// store general runtime information
21 /// and memory usage
22 class InfoActionData
23 {
24 public:
25 InfoActionData& operator += (const InfoActionData& stats);
26
27 public:
28 struct timeval squid_start = {};
29 struct timeval current_time = {};
30 double client_http_clients = 0.0;
31 double client_http_requests = 0.0;
32 double icp_pkts_recv = 0.0;
33 double icp_pkts_sent = 0.0;
34 double icp_replies_queued = 0.0;
35 #if USE_HTCP
36 double htcp_pkts_recv = 0.0;
37 double htcp_pkts_sent = 0.0;
38 #endif
39 double request_failure_ratio = 0.0;
40 double avg_client_http_requests = 0.0;
41 double avg_icp_messages = 0.0;
42 double select_loops = 0.0;
43 double avg_loop_time = 0.0;
44 double request_hit_ratio5 = 0.0;
45 double request_hit_ratio60 = 0.0;
46 double byte_hit_ratio5 = 0.0;
47 double byte_hit_ratio60 = 0.0;
48 double request_hit_mem_ratio5 = 0.0;
49 double request_hit_mem_ratio60 = 0.0;
50 double request_hit_disk_ratio5 = 0.0;
51 double request_hit_disk_ratio60 = 0.0;
52
53 StoreInfoStats store; ///< disk and memory cache statistics
54
55 double unlink_requests = 0.0;
56 double http_requests5 = 0.0;
57 double http_requests60 = 0.0;
58 double cache_misses5 = 0.0;
59 double cache_misses60 = 0.0;
60 double cache_hits5 = 0.0;
61 double cache_hits60 = 0.0;
62 double near_hits5 = 0.0;
63 double near_hits60 = 0.0;
64 double not_modified_replies5 = 0.0;
65 double not_modified_replies60 = 0.0;
66 double dns_lookups5 = 0.0;
67 double dns_lookups60 = 0.0;
68 double icp_queries5 = 0.0;
69 double icp_queries60 = 0.0;
70 double up_time = 0.0;
71 double cpu_time = 0.0;
72 double cpu_usage = 0.0;
73 double cpu_usage5 = 0.0;
74 double cpu_usage60 = 0.0;
75 double maxrss = 0.0;
76 double page_faults = 0.0;
77 #if HAVE_MSTATS && HAVE_GNUMALLOC_H
78 double ms_bytes_total = 0.0;
79 double ms_bytes_free = 0.0;
80 #endif
81 double total_accounted = 0.0;
82 double gb_saved_count = 0.0;
83 double gb_freed_count = 0.0;
84 double max_fd = 0.0;
85 double biggest_fd = 0.0;
86 double number_fd = 0.0;
87 double opening_fd = 0.0;
88 double num_fd_free = 0.0;
89 double reserved_fd = 0.0;
90 unsigned int count = 0;
91 };
92
93 /// implement aggregated 'info' action
94 class InfoAction: public Action
95 {
96 protected:
97 InfoAction(const CommandPointer &cmd);
98
99 public:
100 static Pointer Create(const CommandPointer &cmd);
101 /* Action API */
102 virtual void add(const Action& action);
103 virtual void respond(const Request& request);
104 virtual void pack(Ipc::TypedMsgHdr& msg) const;
105 virtual void unpack(const Ipc::TypedMsgHdr& msg);
106
107 protected:
108 /* Action API */
109 virtual void collect();
110 virtual void dump(StoreEntry* entry);
111
112 private:
113 InfoActionData data;
114 };
115
116 } // namespace Mgr
117
118 #endif /* SQUID_MGR_INFO_ACTION_H */
119