]>
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/Mutex.h"
3 #include "common/Cond.h"
4 #include "include/rados/librados.hpp"
13 mutable Mutex stat_lock
;
15 TestOpStat() : stat_lock("TestOpStat lock") {}
17 static uint64_t gettime()
21 return (1000000*t
.tv_sec
) + t
.tv_usec
;
26 map
<TestOp
*,uint64_t> inflight
;
27 multiset
<uint64_t> latencies
;
28 void begin(TestOp
*in
)
30 assert(!inflight
.count(in
));
31 inflight
[in
] = gettime();
36 assert(inflight
.count(in
));
37 uint64_t curtime
= gettime();
38 latencies
.insert(curtime
- inflight
[in
]);
42 void export_latencies(map
<double,uint64_t> &in
) const;
44 map
<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
);