]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/osd/TestOpStat.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 #include "common/ceph_mutex.h"
3 #include "common/Cond.h"
4 #include "include/rados/librados.hpp"
13 mutable ceph::mutex stat_lock
= ceph::make_mutex("TestOpStat lock");
15 TestOpStat() = default;
17 static uint64_t gettime()
21 return (1000000*t
.tv_sec
) + t
.tv_usec
;
26 std::map
<TestOp
*,uint64_t> inflight
;
27 std::multiset
<uint64_t> latencies
;
28 void begin(TestOp
*in
)
30 ceph_assert(!inflight
.count(in
));
31 inflight
[in
] = gettime();
36 ceph_assert(inflight
.count(in
));
37 uint64_t curtime
= gettime();
38 latencies
.insert(curtime
- inflight
[in
]);
42 void export_latencies(std::map
<double,uint64_t> &in
) const;
44 std::map
<std::string
,TypeStatus
> stats
;
46 void begin(TestOp
*in
);
48 friend std::ostream
& operator<<(std::ostream
&, const TestOpStat
&);
51 std::ostream
& operator<<(std::ostream
&out
, const TestOpStat
&rhs
);