IoAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 "IoStats.h"
14 #include "ipc/Messages.h"
15 #include "ipc/TypedMsgHdr.h"
16 #include "mgr/IoAction.h"
17 #include "SquidMath.h"
18 #include "Store.h"
19 #include "tools.h"
20 
23 
25 {
26  memset(this, 0, sizeof(*this));
27 }
28 
31 {
32  http_reads += stats.http_reads;
33  for (int i = 0; i < IoStats::histSize; ++i)
34  http_read_hist[i] += stats.http_read_hist[i];
35  ftp_reads += stats.ftp_reads;
36  for (int i = 0; i < IoStats::histSize; ++i)
37  ftp_read_hist[i] += stats.ftp_read_hist[i];
38  gopher_reads += stats.gopher_reads;
39  for (int i = 0; i < IoStats::histSize; ++i)
40  gopher_read_hist[i] += stats.gopher_read_hist[i];
41 
42  return *this;
43 }
44 
47 {
48  return new IoAction(cmd);
49 }
50 
52  Action(aCmd), data()
53 {
54  debugs(16, 5, HERE);
55 }
56 
57 void
59 {
60  debugs(16, 5, HERE);
61  data += dynamic_cast<const IoAction&>(action).data;
62 }
63 
64 void
66 {
68 }
69 
70 void
72 {
73  debugs(16, 5, HERE);
74  Must(entry != NULL);
75  DumpIoStats(data, entry);
76 }
77 
78 void
80 {
82  msg.putPod(data);
83 }
84 
85 void
87 {
89  msg.getPod(data);
90 }
91 
double http_reads
Definition: IoAction.h:28
store size histograms of network read() from peer server
Definition: IoAction.h:21
void getPod(Pod &pod) const
load POD
Definition: TypedMsgHdr.h:50
int i
Definition: membanger.c:49
static Pointer Create(const CommandPointer &cmd)
Definition: IoAction.cc:46
double gopher_reads
Definition: IoAction.h:30
void putPod(const Pod &pod)
store POD
Definition: TypedMsgHdr.h:52
class Ping::pingStats_ stats
double http_read_hist[IoStats::histSize]
Definition: IoAction.h:31
implement aggregated 'io' action
Definition: IoAction.h:37
void GetIoStats(Mgr::IoActionData &stats)
Definition: stat.cc:198
IoAction(const CommandPointer &cmd)
Definition: IoAction.cc:51
void const char HLPCB void * data
Definition: stub_helper.cc:16
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
virtual void collect()
calculate and keep local action-specific information
Definition: IoAction.cc:65
double gopher_read_hist[IoStats::histSize]
Definition: IoAction.h:33
virtual void pack(Ipc::TypedMsgHdr &msg) const
pack collected action info into a message to be sent to Coordinator
Definition: IoAction.cc:79
virtual void dump(StoreEntry *entry)
Definition: IoAction.cc:71
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:147
bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:311
#define Must(cond)
Definition: TextException.h:89
IoActionData & operator+=(const IoActionData &stats)
Definition: IoAction.cc:30
double ftp_reads
Definition: IoAction.h:29
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition: IoAction.cc:58
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
double ftp_read_hist[IoStats::histSize]
Definition: IoAction.h:32
void checkType(int aType) const
throws if stored type is not aType
Definition: TypedMsgHdr.cc:84
virtual void unpack(const Ipc::TypedMsgHdr &msg)
unpack action info from the message received by Coordinator
Definition: IoAction.cc:86
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:90
static const int histSize
Definition: IoStats.h:16
#define NULL
Definition: types.h:166
void DumpIoStats(Mgr::IoActionData &stats, StoreEntry *sentry)
Definition: stat.cc:222

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors