CountersAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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 "SquidTime.h"
17 #include "Store.h"
18 #include "tools.h"
19 
22 
24 {
25  memset(this, 0, sizeof(*this));
26 }
27 
30 {
31  if (timercmp(&sample_time, &stats.sample_time, <))
32  sample_time = stats.sample_time;
69 #if USE_CACHE_DIGESTS
72  cd_msgs_sent += stats.cd_msgs_sent;
73  cd_msgs_recv += stats.cd_msgs_recv;
74  cd_memory += stats.cd_memory;
78 #endif
80  page_faults += stats.page_faults;
81  select_loops += stats.select_loops;
82  cpu_time += stats.cpu_time;
83  wall_time += stats.wall_time;
84  swap_outs += stats.swap_outs;
85  swap_ins += stats.swap_ins;
88 
89  return *this;
90 }
91 
94 {
95  return new CountersAction(cmd);
96 }
97 
99  Action(aCmd), data()
100 {
101  debugs(16, 5, HERE);
102 }
103 
104 void
106 {
107  debugs(16, 5, HERE);
108  data += dynamic_cast<const CountersAction&>(action).data;
109 }
110 
111 void
113 {
114  debugs(16, 5, HERE);
116 }
117 
118 void
120 {
121  debugs(16, 5, HERE);
122  Must(entry != NULL);
123  DumpCountersStats(data, entry);
124 }
125 
126 void
128 {
130  msg.putPod(data);
131 }
132 
133 void
135 {
137  msg.getPod(data);
138 }
139 
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
#define timercmp(tvp, uvp, cmp)
Definition: snmp_api_util.h:76
virtual void dump(StoreEntry *entry)
struct timeval sample_time
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:52
class Ping::pingStats_ stats
#define Must(condition)
Like assert() but throws an exception instead of aborting the process.
Definition: TextException.h:69
static Pointer Create(const CommandPointer &cmd)
void GetCountersStats(Mgr::CountersActionData &stats)
Definition: stat.cc:1366
void const char HLPCB void * data
Definition: stub_helper.cc:16
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:128
CountersActionData & operator+=(const CountersActionData &stats)
CountersAction(const CommandPointer &cmd)
implement aggregated &#39;counters&#39; action
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:157
bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:311
virtual void unpack(const Ipc::TypedMsgHdr &msg)
unpack action info from the message received by Coordinator
virtual void collect()
calculate and keep local action-specific information
void DumpCountersStats(Mgr::CountersActionData &stats, StoreEntry *sentry)
Definition: stat.cc:1442
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
virtual void pack(Ipc::TypedMsgHdr &msg) const
pack collected action info into a message to be sent to Coordinator
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:107
void checkType(int aType) const
throws if stored type is not aType
Definition: TypedMsgHdr.cc:101
store traffic and resource counters
#define NULL
Definition: types.h:166
CountersActionData data

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors