mirror of
https://github.com/ceph/ceph
synced 2025-02-23 11:07:35 +00:00
Merge pull request #19149 from rzarzynski/wip-common-perfguards
common: RAII-styled mechanism for updating PerfCounters Reviewed-by: Haomai Wang <haomai@xsky.com> Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
f05b093f02
@ -352,6 +352,24 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class PerfGuard {
|
||||
const ceph::real_clock::time_point start;
|
||||
PerfCounters* const counters;
|
||||
const int event;
|
||||
|
||||
public:
|
||||
PerfGuard(PerfCounters* const counters,
|
||||
const int event)
|
||||
: start(ceph::real_clock::now()),
|
||||
counters(counters),
|
||||
event(event) {
|
||||
}
|
||||
|
||||
~PerfGuard() {
|
||||
counters->tinc(event, ceph::real_clock::now() - start);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class PerfCountersDeleter {
|
||||
CephContext* cct;
|
||||
|
Loading…
Reference in New Issue
Block a user