]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/IoAction.cc
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 16 Cache Manager API */
12 #include "base/TextException.h"
14 #include "ipc/Messages.h"
15 #include "ipc/TypedMsgHdr.h"
16 #include "mgr/IoAction.h"
17 #include "SquidMath.h"
21 void GetIoStats(Mgr::IoActionData
& stats
);
22 void DumpIoStats(Mgr::IoActionData
& stats
, StoreEntry
* sentry
);
24 Mgr::IoActionData::IoActionData()
26 memset(this, 0, sizeof(*this));
30 Mgr::IoActionData::operator += (const IoActionData
& stats
)
32 http_reads
+= stats
.http_reads
;
33 for (int i
= 0; i
< IoStats::histSize
; ++i
)
34 http_read_hist
[i
] += stats
.http_read_hist
[i
];
35 ftp_reads
+= stats
.ftp_reads
;
36 for (int i
= 0; i
< IoStats::histSize
; ++i
)
37 ftp_read_hist
[i
] += stats
.ftp_read_hist
[i
];
38 gopher_reads
+= stats
.gopher_reads
;
39 for (int i
= 0; i
< IoStats::histSize
; ++i
)
40 gopher_read_hist
[i
] += stats
.gopher_read_hist
[i
];
45 Mgr::IoAction::Pointer
46 Mgr::IoAction::Create(const CommandPointer
&cmd
)
48 return new IoAction(cmd
);
51 Mgr::IoAction::IoAction(const CommandPointer
&aCmd
):
58 Mgr::IoAction::add(const Action
& action
)
61 data
+= dynamic_cast<const IoAction
&>(action
).data
;
65 Mgr::IoAction::collect()
71 Mgr::IoAction::dump(StoreEntry
* entry
)
75 DumpIoStats(data
, entry
);
79 Mgr::IoAction::pack(Ipc::TypedMsgHdr
& msg
) const
81 msg
.setType(Ipc::mtCacheMgrResponse
);
86 Mgr::IoAction::unpack(const Ipc::TypedMsgHdr
& msg
)
88 msg
.checkType(Ipc::mtCacheMgrResponse
);