]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/DiskIO/DiskDaemon/DiskdAction.cc
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 79 Squid-side DISKD I/O functions. */
12 #include "base/TextException.h"
13 #include "DiskIO/DiskDaemon/DiskdAction.h"
14 #include "DiskIO/DiskDaemon/DiskdIOStrategy.h"
15 #include "ipc/Messages.h"
16 #include "ipc/TypedMsgHdr.h"
17 #include "mgr/ActionWriter.h"
21 DiskdActionData::DiskdActionData()
23 memset(this, 0, sizeof(*this));
27 DiskdActionData::operator += (const DiskdActionData
& stats
)
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
;
60 DiskdAction::Create(const Mgr::CommandPointer
&aCmd
)
62 return new DiskdAction(aCmd
);
65 DiskdAction::DiskdAction(const Mgr::CommandPointer
&aCmd
):
72 DiskdAction::add(const Action
& action
)
75 data
+= dynamic_cast<const DiskdAction
&>(action
).data
;
79 DiskdAction::collect()
81 data
.sent_count
= diskd_stats
.sent_count
;
82 data
.recv_count
= diskd_stats
.recv_count
;
83 data
.max_away
= diskd_stats
.max_away
;
84 data
.max_shmuse
= diskd_stats
.max_shmuse
;
85 data
.open_fail_queue_len
= diskd_stats
.open_fail_queue_len
;
86 data
.block_queue_len
= diskd_stats
.block_queue_len
;
87 diskd_stats
.max_away
= diskd_stats
.max_shmuse
= 0;
89 data
.open_ops
= diskd_stats
.open
.ops
;
90 data
.open_success
= diskd_stats
.open
.success
;
91 data
.open_fail
= diskd_stats
.open
.fail
;
93 data
.create_ops
= diskd_stats
.create
.ops
;
94 data
.create_success
= diskd_stats
.create
.success
;
95 data
.create_fail
= diskd_stats
.create
.fail
;
97 data
.close_ops
= diskd_stats
.close
.ops
;
98 data
.close_success
= diskd_stats
.close
.success
;
99 data
.close_fail
= diskd_stats
.close
.fail
;
101 data
.unlink_ops
= diskd_stats
.unlink
.ops
;
102 data
.unlink_success
= diskd_stats
.unlink
.success
;
103 data
.unlink_fail
= diskd_stats
.unlink
.fail
;
105 data
.read_ops
= diskd_stats
.read
.ops
;
106 data
.read_success
= diskd_stats
.read
.success
;
107 data
.read_fail
= diskd_stats
.read
.fail
;
109 data
.write_ops
= diskd_stats
.write
.ops
;
110 data
.write_success
= diskd_stats
.write
.success
;
111 data
.write_fail
= diskd_stats
.write
.fail
;
115 DiskdAction::dump(StoreEntry
* entry
)
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",
127 "open", data
.open_ops
, data
.open_success
, data
.open_fail
);
128 storeAppendPrintf(entry
, "%7s %9.0f %9.0f %7.0f\n",
129 "create", data
.create_ops
, data
.create_success
, data
.create_fail
);
130 storeAppendPrintf(entry
, "%7s %9.0f %9.0f %7.0f\n",
131 "close", data
.close_ops
, data
.close_success
, data
.close_fail
);
132 storeAppendPrintf(entry
, "%7s %9.0f %9.0f %7.0f\n",
133 "unlink", data
.unlink_ops
, data
.unlink_success
, data
.unlink_fail
);
134 storeAppendPrintf(entry
, "%7s %9.0f %9.0f %7.0f\n",
135 "read", data
.read_ops
, data
.read_success
, data
.read_fail
);
136 storeAppendPrintf(entry
, "%7s %9.0f %9.0f %7.0f\n",
137 "write", data
.write_ops
, data
.write_success
, data
.write_fail
);
141 DiskdAction::pack(Ipc::TypedMsgHdr
& hdrMsg
) const
143 hdrMsg
.setType(Ipc::mtCacheMgrResponse
);
148 DiskdAction::unpack(const Ipc::TypedMsgHdr
& hdrMsg
)
150 hdrMsg
.checkType(Ipc::mtCacheMgrResponse
);