]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/osd/TestOpStat.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 #include "include/interval_set.h"
3 #include "include/buffer.h"
7 #include "RadosModel.h"
8 #include "TestOpStat.h"
10 void TestOpStat::begin(TestOp
*in
) {
12 stats
[in
->getType()].begin(in
);
16 void TestOpStat::end(TestOp
*in
) {
18 stats
[in
->getType()].end(in
);
22 void TestOpStat::TypeStatus::export_latencies(map
<double,uint64_t> &in
) const
24 map
<double,uint64_t>::iterator i
= in
.begin();
25 multiset
<uint64_t>::iterator j
= latencies
.begin();
27 while (j
!= latencies
.end() && i
!= in
.end()) {
29 if ((((double)count
)/((double)latencies
.size())) * 100 >= i
->first
) {
37 std::ostream
& operator<<(std::ostream
&out
, const TestOpStat
&rhs
)
40 for (auto i
= rhs
.stats
.begin();
43 map
<double,uint64_t> latency
;
48 i
->second
.export_latencies(latency
);
50 out
<< i
->first
<< " latency: " << std::endl
;
51 for (map
<double,uint64_t>::iterator j
= latency
.begin();
54 if (j
->second
== 0) break;
55 out
<< "\t" << j
->first
<< "th percentile: "
56 << j
->second
/ 1000 << "ms" << std::endl
;
59 rhs
.stat_lock
.Unlock();