Correctly use iters_ in ProducerConsumerQueueBenchmark
authorElliott Clark <elliott@fb.com>
Tue, 19 Jul 2016 22:30:08 +0000 (15:30 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Tue, 19 Jul 2016 22:38:27 +0000 (15:38 -0700)
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

index 068dfc0661e3d28ec40c9296ad4c75b8224b2cdf..cb955615ead8f6815424acc9c21f63bb2d1f3132 100644 (file)
@@ -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() {