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