CountersAction.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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#include "squid.h"
12#include "base/TextException.h"
13#include "ipc/Messages.h"
14#include "ipc/TypedMsgHdr.h"
15#include "mgr/CountersAction.h"
16#include "Store.h"
17#include "tools.h"
18
21
23{
24 memset(this, 0, sizeof(*this));
25}
26
29{
30 if (timercmp(&sample_time, &stats.sample_time, <))
31 sample_time = stats.sample_time;
32 client_http_requests += stats.client_http_requests;
33 client_http_hits += stats.client_http_hits;
34 client_http_errors += stats.client_http_errors;
35 client_http_kbytes_in += stats.client_http_kbytes_in;
36 client_http_kbytes_out += stats.client_http_kbytes_out;
37 client_http_hit_kbytes_out += stats.client_http_hit_kbytes_out;
38 server_all_requests += stats.server_all_requests;
39 server_all_errors += stats.server_all_errors;
40 server_all_kbytes_in += stats.server_all_kbytes_in;
41 server_all_kbytes_out += stats.server_all_kbytes_out;
42 server_http_requests += stats.server_http_requests;
43 server_http_errors += stats.server_http_errors;
44 server_http_kbytes_in += stats.server_http_kbytes_in;
45 server_http_kbytes_out += stats.server_http_kbytes_out;
46 server_ftp_requests += stats.server_ftp_requests;
47 server_ftp_errors += stats.server_ftp_errors;
48 server_ftp_kbytes_in += stats.server_ftp_kbytes_in;
49 server_ftp_kbytes_out += stats.server_ftp_kbytes_out;
50 server_other_requests += stats.server_other_requests;
51 server_other_errors += stats.server_other_errors;
52 server_other_kbytes_in += stats.server_other_kbytes_in;
53 server_other_kbytes_out += stats.server_other_kbytes_out;
54 icp_pkts_sent += stats.icp_pkts_sent;
55 icp_pkts_recv += stats.icp_pkts_recv;
56 icp_queries_sent += stats.icp_queries_sent;
57 icp_replies_sent += stats.icp_replies_sent;
58 icp_queries_recv += stats.icp_queries_recv;
59 icp_replies_recv += stats.icp_replies_recv;
60 icp_replies_queued += stats.icp_replies_queued;
61 icp_query_timeouts += stats.icp_query_timeouts;
62 icp_kbytes_sent += stats.icp_kbytes_sent;
63 icp_kbytes_recv += stats.icp_kbytes_recv;
64 icp_q_kbytes_sent += stats.icp_q_kbytes_sent;
65 icp_r_kbytes_sent += stats.icp_r_kbytes_sent;
66 icp_q_kbytes_recv += stats.icp_q_kbytes_recv;
67 icp_r_kbytes_recv += stats.icp_r_kbytes_recv;
68#if USE_CACHE_DIGESTS
69 icp_times_used += stats.icp_times_used;
70 cd_times_used += stats.cd_times_used;
71 cd_msgs_sent += stats.cd_msgs_sent;
72 cd_msgs_recv += stats.cd_msgs_recv;
73 cd_memory += stats.cd_memory;
74 cd_local_memory += stats.cd_local_memory;
75 cd_kbytes_sent += stats.cd_kbytes_sent;
76 cd_kbytes_recv += stats.cd_kbytes_recv;
77#endif
78 unlink_requests += stats.unlink_requests;
79 page_faults += stats.page_faults;
80 select_loops += stats.select_loops;
81 cpu_time += stats.cpu_time;
82 wall_time += stats.wall_time;
83 swap_outs += stats.swap_outs;
84 swap_ins += stats.swap_ins;
85 swap_files_cleaned += stats.swap_files_cleaned;
86 aborted_requests += stats.aborted_requests;
87 hitValidationAttempts += stats.hitValidationAttempts;
88 hitValidationRefusalsDueToLocking += stats.hitValidationRefusalsDueToLocking;
89 hitValidationRefusalsDueToZeroSize += stats.hitValidationRefusalsDueToZeroSize;
90 hitValidationRefusalsDueToTimeLimit += stats.hitValidationRefusalsDueToTimeLimit;
91 hitValidationFailures += stats.hitValidationFailures;
92
93 return *this;
94}
95
98{
99 return new CountersAction(cmd);
100}
101
103 Action(aCmd), data()
104{
105 debugs(16, 5, MYNAME);
106}
107
108void
110{
111 debugs(16, 5, MYNAME);
112 data += dynamic_cast<const CountersAction&>(action).data;
113}
114
115void
117{
118 debugs(16, 5, MYNAME);
119 GetCountersStats(data);
120}
121
122void
124{
125 debugs(16, 5, MYNAME);
126 Must(entry != nullptr);
127 DumpCountersStats(data, entry);
128}
129
130void
132{
134 msg.putPod(data);
135}
136
137void
139{
141 msg.getPod(data);
142}
143
void GetCountersStats(Mgr::CountersActionData &stats)
Definition: stat.cc:1356
void DumpCountersStats(Mgr::CountersActionData &stats, StoreEntry *sentry)
Definition: stat.cc:1438
#define Must(condition)
Definition: TextException.h:75
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:35
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:118
void checkType(int aType) const
Definition: TypedMsgHdr.cc:94
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:126
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:100
store traffic and resource counters
CountersActionData & operator+=(const CountersActionData &stats)
implement aggregated 'counters' action
void add(const Action &action) override
incrementally merge in remote information (of the same action type)
void pack(Ipc::TypedMsgHdr &msg) const override
pack collected action info into a message to be sent to Coordinator
void collect() override
calculate and keep local action-specific information
CountersAction(const CommandPointer &cmd)
void unpack(const Ipc::TypedMsgHdr &msg) override
unpack action info from the message received by Coordinator
void dump(StoreEntry *entry) override
static Pointer Create(const CommandPointer &cmd)
#define MYNAME
Definition: Stream.h:236
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194
@ mtCacheMgrResponse
Definition: Messages.h:36
class Ping::pingStats_ stats
static bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:315
#define timercmp(tvp, uvp, cmp)
Definition: snmp_api_util.h:76

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors