IntervalAction.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/IntervalAction.h"
16 #include "SquidMath.h"
17 #include "Store.h"
18 #include "tools.h"
19 
20 void GetAvgStat(Mgr::IntervalActionData& stats, int minutes, int hours);
22 
24 {
25  memset(this, 0, sizeof(*this));
26 }
27 
30 {
33  if (timercmp(&sample_end_time, &stats.sample_end_time, <))
79  page_faults += stats.page_faults;
80  select_loops += stats.select_loops;
81  select_fds += stats.select_fds;
84  swap_outs += stats.swap_outs;
85  swap_ins += stats.swap_ins;
104  cpu_time += stats.cpu_time;
105  wall_time += stats.wall_time;
106  ++count;
107 
108  return *this;
109 }
110 
113 {
114  return new IntervalAction(cmd, 5, 0);
115 }
116 
119 {
120  return new IntervalAction(cmd, 60, 0);
121 }
122 
123 Mgr::IntervalAction::IntervalAction(const CommandPointer &aCmd, int aMinutes, int aHours):
124  Action(aCmd), minutes(aMinutes), hours(aHours), data()
125 {
126  debugs(16, 5, HERE);
127 }
128 
129 void
131 {
132  debugs(16, 5, HERE);
133  data += dynamic_cast<const IntervalAction&>(action).data;
134 }
135 
136 void
138 {
140 }
141 
142 void
144 {
145  debugs(16, 5, HERE);
146  Must(entry != NULL);
147  DumpAvgStat(data, entry);
148 }
149 
150 void
152 {
154  msg.putPod(data);
155 }
156 
157 void
159 {
161  msg.getPod(data);
162 }
163 
#define timerisset(tvp)
Definition: snmp_api_util.h:85
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
#define timercmp(tvp, uvp, cmp)
Definition: snmp_api_util.h:76
virtual void pack(Ipc::TypedMsgHdr &msg) const
pack collected action info into a message to be sent to Coordinator
void DumpAvgStat(Mgr::IntervalActionData &stats, StoreEntry *sentry)
Definition: stat.cc:1020
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
double client_http_all_median_svc_time
static Pointer Create60min(const CommandPointer &cmd)
virtual void collect()
calculate and keep local action-specific information
void const char HLPCB void * data
Definition: stub_helper.cc:16
implement aggregated interval actions
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:124
IntervalActionData & operator+=(const IntervalActionData &stats)
double client_http_miss_median_svc_time
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:153
bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:311
struct timeval sample_start_time
virtual void unpack(const Ipc::TypedMsgHdr &msg)
unpack action info from the message received by Coordinator
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
struct timeval sample_end_time
IntervalAction(const CommandPointer &cmd, int aMinutes, int aHours)
IntervalActionData data
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
virtual void dump(StoreEntry *entry)
void GetAvgStat(Mgr::IntervalActionData &stats, int minutes, int hours)
Definition: stat.cc:890
#define NULL
Definition: types.h:166
static Pointer Create5min(const CommandPointer &cmd)
double client_http_hit_median_svc_time

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors