]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/IoAction.cc
2 * DEBUG: section 16 Cache Manager API
7 #include "base/TextException.h"
9 #include "ipc/Messages.h"
10 #include "ipc/TypedMsgHdr.h"
11 #include "mgr/IoAction.h"
12 #include "SquidMath.h"
16 void GetIoStats(Mgr::IoActionData
& stats
);
17 void DumpIoStats(Mgr::IoActionData
& stats
, StoreEntry
* sentry
);
19 Mgr::IoActionData::IoActionData()
21 xmemset(this, 0, sizeof(*this));
25 Mgr::IoActionData::operator += (const IoActionData
& stats
)
27 http_reads
+= stats
.http_reads
;
28 for (int i
= 0; i
< IoStats::histSize
; ++i
)
29 http_read_hist
[i
] += stats
.http_read_hist
[i
];
30 ftp_reads
+= stats
.ftp_reads
;
31 for (int i
= 0; i
< IoStats::histSize
; ++i
)
32 ftp_read_hist
[i
] += stats
.ftp_read_hist
[i
];
33 gopher_reads
+= stats
.gopher_reads
;
34 for (int i
= 0; i
< IoStats::histSize
; ++i
)
35 gopher_read_hist
[i
] += stats
.gopher_read_hist
[i
];
40 Mgr::IoAction::Pointer
41 Mgr::IoAction::Create(const CommandPointer
&cmd
)
43 return new IoAction(cmd
);
46 Mgr::IoAction::IoAction(const CommandPointer
&cmd
):
53 Mgr::IoAction::add(const Action
& action
)
56 data
+= dynamic_cast<const IoAction
&>(action
).data
;
60 Mgr::IoAction::collect()
66 Mgr::IoAction::dump(StoreEntry
* entry
)
70 DumpIoStats(data
, entry
);
74 Mgr::IoAction::pack(Ipc::TypedMsgHdr
& msg
) const
76 msg
.setType(Ipc::mtCacheMgrResponse
);
81 Mgr::IoAction::unpack(const Ipc::TypedMsgHdr
& msg
)
83 msg
.checkType(Ipc::mtCacheMgrResponse
);