From: xinxin shu Date: Thu, 13 Aug 2015 03:57:58 +0000 (+0800) Subject: fix print error of rados bench X-Git-Tag: v9.1.0~364^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4eaa9ea1c95124f524eda267b14deb989731e5c9;p=ceph.git fix print error of rados bench Total time run: 12.279167 Total writes made: 92 Write size: 4194304 Bandwidth (MB/sec): 30 Stddev Bandwidth: 23.4 Max bandwidth (MB/sec): 64 Min bandwidth (MB/sec): 2 Average IOPS: 7 Stddev IOPS: 6 Max IOPS: 32767 Min IOPS: -1537890352 Average Latency: 2.12 Stddev Latency: 1.35 Max latency: 6.05 Min latency: 0.501 Signed-off-by: xinxin shu --- diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index e384511324ed..baaff266c9ae 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -107,9 +107,9 @@ void *ObjBencher::status_printer(void *_bencher) { / (1024*1024) / cycleSinceChange; else - bandwidth = 0; + bandwidth = -1; - if (!std::isnan(bandwidth) && bandwidth > 0) { + if (!std::isnan(bandwidth) && bandwidth > -1) { if (bandwidth > data.idata.max_bandwidth) data.idata.max_bandwidth = bandwidth; if (bandwidth < data.idata.min_bandwidth) @@ -122,9 +122,9 @@ void *ObjBencher::status_printer(void *_bencher) { iops = (double)(data.finished - previous_writes) / cycleSinceChange; else - iops = 0; + iops = -1; - if (!std::isnan(iops)) { + if (!std::isnan(iops) && iops > -1) { if (iops > data.idata.max_iops) data.idata.max_iops = iops; if (iops < data.idata.min_iops) @@ -201,8 +201,6 @@ int ObjBencher::aio_bench( data.min_latency = 9999.0; // this better be higher than initial latency! data.max_latency = 0; data.avg_latency = 0; - data.idata.min_bandwidth = 99999999.0; - data.idata.max_bandwidth = 0; data.object_contents = contentsChars; lock.Unlock(); diff --git a/src/common/obj_bencher.h b/src/common/obj_bencher.h index 832461bb99d2..9d40ccb0e180 100644 --- a/src/common/obj_bencher.h +++ b/src/common/obj_bencher.h @@ -18,12 +18,13 @@ #include "common/config.h" #include "common/Cond.h" #include "common/ceph_context.h" +#include struct bench_interval_data { - double min_bandwidth; - double max_bandwidth; - int min_iops; - int max_iops; + double min_bandwidth = DBL_MAX; + double max_bandwidth = 0; + int min_iops = INT_MAX; + int max_iops = 0; }; struct bench_history {