From 26b139fc3520828f080d459b0f8cbd271cab7a89 Mon Sep 17 00:00:00 2001 From: Elliott Clark Date: Tue, 19 Jul 2016 15:30:08 -0700 Subject: [PATCH] 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 --- folly/test/ProducerConsumerQueueBenchmark.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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() { -- 2.34.1