IoAction.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
39 return *this;
40}
41
44{
45 return new IoAction(cmd);
46}
47
49 Action(aCmd), data()
50{
51 debugs(16, 5, MYNAME);
52}
53
54void
56{
57 debugs(16, 5, MYNAME);
58 data += dynamic_cast<const IoAction&>(action).data;
59}
60
61void
63{
64 GetIoStats(data);
65}
66
67void
69{
70 debugs(16, 5, MYNAME);
71 Must(entry != nullptr);
72 DumpIoStats(data, entry);
73}
74
75void
77{
79 msg.putPod(data);
80}
81
82void
84{
86 msg.getPod(data);
87}
88
void GetIoStats(Mgr::IoActionData &stats)
Definition: stat.cc:188
void DumpIoStats(Mgr::IoActionData &stats, StoreEntry *sentry)
Definition: stat.cc:206
#define Must(condition)
Definition: TextException.h:71
static const int histSize
Definition: IoStats.h:16
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:128
void setType(int aType)
sets message type; use MessageType enum
Definition: TypedMsgHdr.cc:100
store size histograms of network read() from peer server
Definition: IoAction.h:22
IoActionData & operator+=(const IoActionData &stats)
Definition: IoAction.cc:30
implement aggregated 'io' action
Definition: IoAction.h:36
virtual void unpack(const Ipc::TypedMsgHdr &msg)
unpack action info from the message received by Coordinator
Definition: IoAction.cc:83
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition: IoAction.cc:55
virtual void pack(Ipc::TypedMsgHdr &msg) const
pack collected action info into a message to be sent to Coordinator
Definition: IoAction.cc:76
virtual void collect()
calculate and keep local action-specific information
Definition: IoAction.cc:62
virtual void dump(StoreEntry *entry)
Definition: IoAction.cc:68
IoAction(const CommandPointer &cmd)
Definition: IoAction.cc:48
static Pointer Create(const CommandPointer &cmd)
Definition: IoAction.cc:43
#define MYNAME
Definition: Stream.h:238
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
@ 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:311

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors