From 7258c99ba8e811697acf307e9660d209eb82ba41 Mon Sep 17 00:00:00 2001 From: PC Date: Thu, 13 Jul 2017 13:38:46 +0800 Subject: [PATCH] =?utf8?q?common=EF=BC=9Abench=20test=20bug=20when=20=3D0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: src/common/obj_bencher.cc b/src/common/obj_bencher.cc :write_bench(),seq_read_bench(),rand_read_bench() the program may fall into a dead loop if the set as 0 Signed-off-by:PCzhangPC pengcheng.zhang@easystack.cn --- src/common/obj_bencher.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index 4eaeba3471f7c..411dac3dd9d6a 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -460,7 +460,7 @@ int ObjBencher::write_bench(int secondsToRun, stopTime = data.start_time + runtime; slot = 0; lock.Lock(); - while (!secondsToRun || ceph_clock_now() < stopTime) { + while (secondsToRun && ceph_clock_now() < stopTime) { bool found = false; while (1) { int old_slot = slot; @@ -690,7 +690,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre bufferlist *cur_contents; slot = 0; - while ((!seconds_to_run || ceph_clock_now() < finish_time) && + while ((seconds_to_run && ceph_clock_now() < finish_time) && num_objects > data.started) { lock.Lock(); int old_slot = slot; @@ -920,7 +920,7 @@ int ObjBencher::rand_read_bench(int seconds_to_run, int num_objects, int concurr int rand_id; slot = 0; - while ((!seconds_to_run || ceph_clock_now() < finish_time)) { + while ((seconds_to_run && ceph_clock_now() < finish_time)) { lock.Lock(); int old_slot = slot; bool found = false; -- 2.39.5