From: Elliott Clark Date: Tue, 19 Jul 2016 22:30:08 +0000 (-0700) Subject: Correctly use iters_ in ProducerConsumerQueueBenchmark X-Git-Tag: 2016.07.26~28 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=26b139fc3520828f080d459b0f8cbd271cab7a89;p=folly.git Correctly use iters_ in ProducerConsumerQueueBenchmark Summary: iters was only being used on one side of the producer/consumer. Reviewed By: yfeldblum Differential Revision: D3588593 fbshipit-source-id: 5e9a8a02bb9addbd6f936b8cc411d58cdf82b6e2 --- diff --git a/folly/test/ProducerConsumerQueueBenchmark.cpp b/folly/test/ProducerConsumerQueueBenchmark.cpp index 068dfc06..cb955615 100644 --- a/folly/test/ProducerConsumerQueueBenchmark.cpp +++ b/folly/test/ProducerConsumerQueueBenchmark.cpp @@ -98,15 +98,14 @@ struct LatencyTest { } void computeTimeCost() { - int iterations = 1000; timespec start, end; clock_gettime(CLOCK_REALTIME, &start); - for (int i = 0; i < iterations; ++i) { + for (int i = 0; i < iters_; ++i) { timespec tv; clock_gettime(CLOCK_REALTIME, &tv); } clock_gettime(CLOCK_REALTIME, &end); - time_cost_ = 2 * detail::timespecDiff(end, start) / iterations; + time_cost_ = 2 * detail::timespecDiff(end, start) / iters_; } void producer() {