]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/StoreIoAction.cc
2 * Copyright (C) 1996-2016 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 16 Cache Manager API */
12 #include "base/TextException.h"
13 #include "ipc/Messages.h"
14 #include "ipc/TypedMsgHdr.h"
15 #include "mgr/StoreIoAction.h"
19 Mgr::StoreIoActionData::StoreIoActionData()
21 memset(this, 0, sizeof(*this));
24 Mgr::StoreIoActionData
&
25 Mgr::StoreIoActionData::operator += (const StoreIoActionData
& stats
)
27 create_calls
+= stats
.create_calls
;
28 create_select_fail
+= stats
.create_select_fail
;
29 create_create_fail
+= stats
.create_create_fail
;
30 create_success
+= stats
.create_success
;
35 Mgr::StoreIoAction::Pointer
36 Mgr::StoreIoAction::Create(const CommandPointer
&cmd
)
38 return new StoreIoAction(cmd
);
41 Mgr::StoreIoAction::StoreIoAction(const CommandPointer
&aCmd
):
48 Mgr::StoreIoAction::add(const Action
& action
)
51 data
+= dynamic_cast<const StoreIoAction
&>(action
).data
;
55 Mgr::StoreIoAction::collect()
57 data
.create_calls
= store_io_stats
.create
.calls
;
58 data
.create_select_fail
= store_io_stats
.create
.select_fail
;
59 data
.create_create_fail
= store_io_stats
.create
.create_fail
;
60 data
.create_success
= store_io_stats
.create
.success
;
64 Mgr::StoreIoAction::dump(StoreEntry
* entry
)
68 storeAppendPrintf(entry
, "Store IO Interface Stats\n");
69 storeAppendPrintf(entry
, "create.calls %.0f\n", data
.create_calls
);
70 storeAppendPrintf(entry
, "create.select_fail %.0f\n", data
.create_select_fail
);
71 storeAppendPrintf(entry
, "create.create_fail %.0f\n", data
.create_create_fail
);
72 storeAppendPrintf(entry
, "create.success %.0f\n", data
.create_success
);
76 Mgr::StoreIoAction::pack(Ipc::TypedMsgHdr
& msg
) const
78 msg
.setType(Ipc::mtCacheMgrResponse
);
83 Mgr::StoreIoAction::unpack(const Ipc::TypedMsgHdr
& msg
)
85 msg
.checkType(Ipc::mtCacheMgrResponse
);