]>
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/ServiceTimesAction.h" | |
13 | #include "Store.h" | |
14 | ||
15 | ||
16 | extern void GetServiceTimesStats(Mgr::ServiceTimesActionData& stats); | |
17 | extern void DumpServiceTimesStats(Mgr::ServiceTimesActionData& stats, StoreEntry* sentry); | |
18 | ||
19 | Mgr::ServiceTimesActionData::ServiceTimesActionData() | |
20 | { | |
21 | xmemset(this, 0, sizeof(*this)); | |
22 | } | |
23 | ||
24 | Mgr::ServiceTimesActionData& | |
25 | Mgr::ServiceTimesActionData::operator += (const ServiceTimesActionData& stats) | |
26 | { | |
27 | for (int i = 0; i < seriesSize; ++i) { | |
28 | http_requests5[i] += stats.http_requests5[i]; | |
29 | http_requests60[i] += stats.http_requests60[i]; | |
30 | ||
31 | cache_misses5[i] += stats.cache_misses5[i]; | |
32 | cache_misses60[i] += stats.cache_misses60[i]; | |
33 | ||
34 | cache_hits5[i] += stats.cache_hits5[i]; | |
35 | cache_hits60[i] += stats.cache_hits60[i]; | |
36 | ||
37 | near_hits5[i] += stats.near_hits5[i]; | |
38 | near_hits60[i] += stats.near_hits60[i]; | |
39 | ||
40 | not_modified_replies5[i] += stats.not_modified_replies5[i]; | |
41 | not_modified_replies60[i] += stats.not_modified_replies60[i]; | |
42 | ||
43 | dns_lookups5[i] += stats.dns_lookups5[i]; | |
44 | dns_lookups60[i] += stats.dns_lookups60[i]; | |
45 | ||
46 | icp_queries5[i] += stats.icp_queries5[i]; | |
47 | icp_queries60[i] += stats.icp_queries60[i]; | |
48 | } | |
49 | ++count; | |
50 | ||
51 | return *this; | |
52 | } | |
53 | ||
54 | Mgr::ServiceTimesAction::Pointer | |
55 | Mgr::ServiceTimesAction::Create(const CommandPointer &cmd) | |
56 | { | |
57 | return new ServiceTimesAction(cmd); | |
58 | } | |
59 | ||
60 | Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &cmd): | |
d9fc6862 | 61 | Action(cmd), data() |
8822ebee AR |
62 | { |
63 | debugs(16, 5, HERE); | |
64 | } | |
65 | ||
66 | void | |
67 | Mgr::ServiceTimesAction::add(const Action& action) | |
68 | { | |
69 | debugs(16, 5, HERE); | |
70 | data += dynamic_cast<const ServiceTimesAction&>(action).data; | |
71 | } | |
72 | ||
73 | void | |
74 | Mgr::ServiceTimesAction::collect() | |
75 | { | |
76 | debugs(16, 5, HERE); | |
77 | GetServiceTimesStats(data); | |
78 | } | |
79 | ||
80 | void | |
81 | Mgr::ServiceTimesAction::dump(StoreEntry* entry) | |
82 | { | |
83 | debugs(16, 5, HERE); | |
84 | Must(entry != NULL); | |
85 | DumpServiceTimesStats(data, entry); | |
86 | } | |
87 | ||
88 | void | |
89 | Mgr::ServiceTimesAction::pack(Ipc::TypedMsgHdr& msg) const | |
90 | { | |
91 | msg.setType(Ipc::mtCacheMgrResponse); | |
92 | msg.putPod(data); | |
93 | } | |
94 | ||
95 | void | |
96 | Mgr::ServiceTimesAction::unpack(const Ipc::TypedMsgHdr& msg) | |
97 | { | |
98 | msg.checkType(Ipc::mtCacheMgrResponse); | |
99 | msg.getPod(data); | |
100 | } |