DiskdAction.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 79 Squid-side DISKD I/O functions. */
10
11#include "squid.h"
12#include "base/TextException.h"
15#include "ipc/Messages.h"
16#include "ipc/TypedMsgHdr.h"
17#include "mgr/ActionWriter.h"
18#include "Store.h"
19#include "tools.h"
20
22{
23 memset(this, 0, sizeof(*this));
24}
25
28{
29 sent_count += stats.sent_count;
30 recv_count += stats.recv_count;
31 if (stats.max_away > max_away)
32 max_away = stats.max_away;
33 if (stats.max_shmuse > max_shmuse)
34 max_shmuse += stats.max_shmuse;
35 open_fail_queue_len += stats.open_fail_queue_len;
36 block_queue_len += stats.block_queue_len;
37 open_ops += stats.open_ops;
38 open_success += stats.open_success;
39 open_fail += stats.open_fail;
40 create_ops += stats.create_ops;
41 create_success += stats.create_success;
42 create_fail += stats.create_fail;
43 close_ops += stats.close_ops;
44 close_success += stats.close_success;
45 close_fail += stats.close_fail;
46 unlink_ops += stats.unlink_ops;
47 unlink_success += stats.unlink_success;
48 unlink_fail += stats.unlink_fail;
49 read_ops += stats.read_ops;
50 read_success += stats.read_success;
51 read_fail += stats.read_fail;
52 write_ops += stats.write_ops;
53 write_success += stats.write_success;
54 write_fail += stats.write_fail;
55
56 return *this;
57}
58
61{
62 return new DiskdAction(aCmd);
63}
64
66 Action(aCmd), data()
67{
68 debugs(79, 5, MYNAME);
69}
70
71void
73{
74 debugs(79, 5, MYNAME);
75 data += dynamic_cast<const DiskdAction&>(action).data;
76}
77
78void
80{
88
92
96
100
104
108
112}
113
114void
116{
117 debugs(79, 5, MYNAME);
118 Must(entry != nullptr);
119 storeAppendPrintf(entry, "sent_count: %.0f\n", data.sent_count);
120 storeAppendPrintf(entry, "recv_count: %.0f\n", data.recv_count);
121 storeAppendPrintf(entry, "max_away: %.0f\n", data.max_away);
122 storeAppendPrintf(entry, "max_shmuse: %.0f\n", data.max_shmuse);
123 storeAppendPrintf(entry, "open_fail_queue_len: %.0f\n", data.open_fail_queue_len);
124 storeAppendPrintf(entry, "block_queue_len: %.0f\n", data.block_queue_len);
125 storeAppendPrintf(entry, "\n OPS SUCCESS FAIL\n");
126 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
128 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
130 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
132 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
134 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
136 storeAppendPrintf(entry, "%7s %9.0f %9.0f %7.0f\n",
138}
139
140void
142{
144 hdrMsg.putPod(data);
145}
146
147void
149{
151 hdrMsg.getPod(data);
152}
153
#define Must(condition)
Definition: TextException.h:71
store disk daemon stats
Definition: DiskdAction.h:20
double recv_count
Definition: DiskdAction.h:27
double close_success
Definition: DiskdAction.h:39
double unlink_fail
Definition: DiskdAction.h:43
double unlink_ops
Definition: DiskdAction.h:41
double close_fail
Definition: DiskdAction.h:40
double create_ops
Definition: DiskdAction.h:35
double max_shmuse
Definition: DiskdAction.h:29
double create_success
Definition: DiskdAction.h:36
double close_ops
Definition: DiskdAction.h:38
double open_fail
Definition: DiskdAction.h:34
double write_fail
Definition: DiskdAction.h:49
double read_fail
Definition: DiskdAction.h:46
double read_success
Definition: DiskdAction.h:45
double write_success
Definition: DiskdAction.h:48
double create_fail
Definition: DiskdAction.h:37
DiskdActionData & operator+=(const DiskdActionData &stats)
Definition: DiskdAction.cc:27
double open_fail_queue_len
Definition: DiskdAction.h:30
double block_queue_len
Definition: DiskdAction.h:31
double write_ops
Definition: DiskdAction.h:47
double sent_count
Definition: DiskdAction.h:26
double open_success
Definition: DiskdAction.h:33
double unlink_success
Definition: DiskdAction.h:42
implement aggregated 'diskd' action
Definition: DiskdAction.h:54
virtual void unpack(const Ipc::TypedMsgHdr &hdrMsg)
unpack action info from the message received by Coordinator
Definition: DiskdAction.cc:148
DiskdActionData data
Definition: DiskdAction.h:71
virtual void add(const Mgr::Action &action)
incrementally merge in remote information (of the same action type)
Definition: DiskdAction.cc:72
DiskdAction(const Mgr::CommandPointer &aCmd)
Definition: DiskdAction.cc:65
static Pointer Create(const Mgr::CommandPointer &aCmd)
Definition: DiskdAction.cc:60
virtual void dump(StoreEntry *entry)
Definition: DiskdAction.cc:115
virtual void collect()
calculate and keep local action-specific information
Definition: DiskdAction.cc:79
virtual void pack(Ipc::TypedMsgHdr &hdrMsg) const
pack collected action info into a message to be sent to Coordinator
Definition: DiskdAction.cc:141
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
#define MYNAME
Definition: Stream.h:238
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
diskd_stats_t diskd_stats
@ 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
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:828
struct diskd_stats_t::@47 unlink
struct diskd_stats_t::@47 create
struct diskd_stats_t::@47 write
struct diskd_stats_t::@47 open
struct diskd_stats_t::@47 read
struct diskd_stats_t::@47 close

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors