4 * DEBUG: section 16 Cache Manager API
9 #include "base/TextException.h"
10 #include "ipc/Messages.h"
11 #include "ipc/TypedMsgHdr.h"
12 #include "mgr/CountersAction.h"
14 #include "SquidTime.h"
18 extern void GetCountersStats(Mgr::CountersActionData
& stats
);
19 extern void DumpCountersStats(Mgr::CountersActionData
& stats
, StoreEntry
* sentry
);
21 Mgr::CountersActionData::CountersActionData()
23 xmemset(this, 0, sizeof(*this));
26 Mgr::CountersActionData
&
27 Mgr::CountersActionData::operator += (const CountersActionData
& stats
)
29 if (timercmp(&sample_time
, &stats
.sample_time
, <))
30 sample_time
= stats
.sample_time
;
31 client_http_requests
+= stats
.client_http_requests
;
32 client_http_hits
+= stats
.client_http_hits
;
33 client_http_errors
+= stats
.client_http_errors
;
34 client_http_kbytes_in
+= stats
.client_http_kbytes_in
;
35 client_http_kbytes_out
+= stats
.client_http_kbytes_out
;
36 client_http_hit_kbytes_out
+= stats
.client_http_hit_kbytes_out
;
37 server_all_requests
+= stats
.server_all_requests
;
38 server_all_errors
+= stats
.server_all_errors
;
39 server_all_kbytes_in
+= stats
.server_all_kbytes_in
;
40 server_all_kbytes_out
+= stats
.server_all_kbytes_out
;
41 server_http_requests
+= stats
.server_http_requests
;
42 server_http_errors
+= stats
.server_http_errors
;
43 server_http_kbytes_in
+= stats
.server_http_kbytes_in
;
44 server_http_kbytes_out
+= stats
.server_http_kbytes_out
;
45 server_ftp_requests
+= stats
.server_ftp_requests
;
46 server_ftp_errors
+= stats
.server_ftp_errors
;
47 server_ftp_kbytes_in
+= stats
.server_ftp_kbytes_in
;
48 server_ftp_kbytes_out
+= stats
.server_ftp_kbytes_out
;
49 server_other_requests
+= stats
.server_other_requests
;
50 server_other_errors
+= stats
.server_other_errors
;
51 server_other_kbytes_in
+= stats
.server_other_kbytes_in
;
52 server_other_kbytes_out
+= stats
.server_other_kbytes_out
;
53 icp_pkts_sent
+= stats
.icp_pkts_sent
;
54 icp_pkts_recv
+= stats
.icp_pkts_recv
;
55 icp_queries_sent
+= stats
.icp_queries_sent
;
56 icp_replies_sent
+= stats
.icp_replies_sent
;
57 icp_queries_recv
+= stats
.icp_queries_recv
;
58 icp_replies_recv
+= stats
.icp_replies_recv
;
59 icp_replies_queued
+= stats
.icp_replies_queued
;
60 icp_query_timeouts
+= stats
.icp_query_timeouts
;
61 icp_kbytes_sent
+= stats
.icp_kbytes_sent
;
62 icp_kbytes_recv
+= stats
.icp_kbytes_recv
;
63 icp_q_kbytes_sent
+= stats
.icp_q_kbytes_sent
;
64 icp_r_kbytes_sent
+= stats
.icp_r_kbytes_sent
;
65 icp_q_kbytes_recv
+= stats
.icp_q_kbytes_recv
;
66 icp_r_kbytes_recv
+= stats
.icp_r_kbytes_recv
;
68 icp_times_used
+= stats
.icp_times_used
;
69 cd_times_used
+= stats
.cd_times_used
;
70 cd_msgs_sent
+= stats
.cd_msgs_sent
;
71 cd_msgs_recv
+= stats
.cd_msgs_recv
;
72 cd_memory
+= stats
.cd_memory
;
73 cd_local_memory
+= stats
.cd_local_memory
;
74 cd_kbytes_sent
+= stats
.cd_kbytes_sent
;
75 cd_kbytes_recv
+= stats
.cd_kbytes_recv
;
77 unlink_requests
+= stats
.unlink_requests
;
78 page_faults
+= stats
.page_faults
;
79 select_loops
+= stats
.select_loops
;
80 cpu_time
+= stats
.cpu_time
;
81 wall_time
+= stats
.wall_time
;
82 swap_outs
+= stats
.swap_outs
;
83 swap_ins
+= stats
.swap_ins
;
84 swap_files_cleaned
+= stats
.swap_files_cleaned
;
85 aborted_requests
+= stats
.aborted_requests
;
90 Mgr::CountersAction::Pointer
91 Mgr::CountersAction::Create(const CommandPointer
&cmd
)
93 return new CountersAction(cmd
);
96 Mgr::CountersAction::CountersAction(const CommandPointer
&cmd
):
103 Mgr::CountersAction::add(const Action
& action
)
106 data
+= dynamic_cast<const CountersAction
&>(action
).data
;
110 Mgr::CountersAction::collect()
113 GetCountersStats(data
);
117 Mgr::CountersAction::dump(StoreEntry
* entry
)
121 DumpCountersStats(data
, entry
);
125 Mgr::CountersAction::pack(Ipc::TypedMsgHdr
& msg
) const
127 msg
.setType(Ipc::mtCacheMgrResponse
);
132 Mgr::CountersAction::unpack(const Ipc::TypedMsgHdr
& msg
)
134 msg
.checkType(Ipc::mtCacheMgrResponse
);