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