]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mgr/StoreIoAction.cc
Removed CVS $ markers
[thirdparty/squid.git] / src / mgr / StoreIoAction.cc
CommitLineData
8822ebee 1/*
8822ebee
AR
2 * DEBUG: section 16 Cache Manager API
3 *
4 */
5
f7f3304a 6#include "squid.h"
8822ebee
AR
7#include "base/TextException.h"
8#include "ipc/Messages.h"
9#include "ipc/TypedMsgHdr.h"
10#include "mgr/StoreIoAction.h"
11#include "Store.h"
5bed43d6 12#include "tools.h"
8822ebee 13
8822ebee
AR
14Mgr::StoreIoActionData::StoreIoActionData()
15{
16 xmemset(this, 0, sizeof(*this));
17}
18
19Mgr::StoreIoActionData&
20Mgr::StoreIoActionData::operator += (const StoreIoActionData& stats)
21{
22 create_calls += stats.create_calls;
23 create_select_fail += stats.create_select_fail;
24 create_create_fail += stats.create_create_fail;
25 create_success += stats.create_success;
26
27 return *this;
28}
29
30Mgr::StoreIoAction::Pointer
31Mgr::StoreIoAction::Create(const CommandPointer &cmd)
32{
33 return new StoreIoAction(cmd);
34}
35
36Mgr::StoreIoAction::StoreIoAction(const CommandPointer &cmd):
d9fc6862 37 Action(cmd), data()
8822ebee
AR
38{
39 debugs(16, 5, HERE);
40}
41
42void
43Mgr::StoreIoAction::add(const Action& action)
44{
45 debugs(16, 5, HERE);
46 data += dynamic_cast<const StoreIoAction&>(action).data;
47}
48
49void
50Mgr::StoreIoAction::collect()
51{
52 data.create_calls = store_io_stats.create.calls;
53 data.create_select_fail = store_io_stats.create.select_fail;
54 data.create_create_fail = store_io_stats.create.create_fail;
55 data.create_success = store_io_stats.create.success;
56}
57
58void
59Mgr::StoreIoAction::dump(StoreEntry* entry)
60{
61 debugs(16, 5, HERE);
62 Must(entry != NULL);
63 storeAppendPrintf(entry, "Store IO Interface Stats\n");
64 storeAppendPrintf(entry, "create.calls %.0f\n", data.create_calls);
65 storeAppendPrintf(entry, "create.select_fail %.0f\n", data.create_select_fail);
66 storeAppendPrintf(entry, "create.create_fail %.0f\n", data.create_create_fail);
67 storeAppendPrintf(entry, "create.success %.0f\n", data.create_success);
68}
69
70void
71Mgr::StoreIoAction::pack(Ipc::TypedMsgHdr& msg) const
72{
73 msg.setType(Ipc::mtCacheMgrResponse);
74 msg.putPod(data);
75}
76
77void
78Mgr::StoreIoAction::unpack(const Ipc::TypedMsgHdr& msg)
79{
80 msg.checkType(Ipc::mtCacheMgrResponse);
81 msg.getPod(data);
82}