]>
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/IoAction.h" | |
582c2af2 | 13 | #include "protos.h" |
8822ebee AR |
14 | #include "SquidMath.h" |
15 | #include "Store.h" | |
16 | ||
8822ebee AR |
17 | extern void GetIoStats(Mgr::IoActionData& stats); |
18 | extern void DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry); | |
19 | ||
20 | Mgr::IoActionData::IoActionData() | |
21 | { | |
22 | xmemset(this, 0, sizeof(*this)); | |
23 | } | |
24 | ||
25 | Mgr::IoActionData& | |
26 | Mgr::IoActionData::operator += (const IoActionData& stats) | |
27 | { | |
28 | http_reads += stats.http_reads; | |
29 | for (int i = 0; i < _iostats::histSize; ++i) | |
30 | http_read_hist[i] += stats.http_read_hist[i]; | |
31 | ftp_reads += stats.ftp_reads; | |
32 | for (int i = 0; i < _iostats::histSize; ++i) | |
33 | ftp_read_hist[i] += stats.ftp_read_hist[i]; | |
34 | gopher_reads += stats.gopher_reads; | |
35 | for (int i = 0; i < _iostats::histSize; ++i) | |
36 | gopher_read_hist[i] += stats.gopher_read_hist[i]; | |
37 | ||
38 | return *this; | |
39 | } | |
40 | ||
41 | Mgr::IoAction::Pointer | |
42 | Mgr::IoAction::Create(const CommandPointer &cmd) | |
43 | { | |
44 | return new IoAction(cmd); | |
45 | } | |
46 | ||
47 | Mgr::IoAction::IoAction(const CommandPointer &cmd): | |
d9fc6862 | 48 | Action(cmd), data() |
8822ebee AR |
49 | { |
50 | debugs(16, 5, HERE); | |
51 | } | |
52 | ||
53 | void | |
54 | Mgr::IoAction::add(const Action& action) | |
55 | { | |
56 | debugs(16, 5, HERE); | |
57 | data += dynamic_cast<const IoAction&>(action).data; | |
58 | } | |
59 | ||
60 | void | |
61 | Mgr::IoAction::collect() | |
62 | { | |
63 | GetIoStats(data); | |
64 | } | |
65 | ||
66 | void | |
67 | Mgr::IoAction::dump(StoreEntry* entry) | |
68 | { | |
69 | debugs(16, 5, HERE); | |
70 | Must(entry != NULL); | |
71 | DumpIoStats(data, entry); | |
72 | } | |
73 | ||
74 | void | |
75 | Mgr::IoAction::pack(Ipc::TypedMsgHdr& msg) const | |
76 | { | |
77 | msg.setType(Ipc::mtCacheMgrResponse); | |
78 | msg.putPod(data); | |
79 | } | |
80 | ||
81 | void | |
82 | Mgr::IoAction::unpack(const Ipc::TypedMsgHdr& msg) | |
83 | { | |
84 | msg.checkType(Ipc::mtCacheMgrResponse); | |
85 | msg.getPod(data); | |
86 | } |