kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: MINOR: fix integer overflow in simple benchmark MB/sec calculation
Date Thu, 09 Feb 2017 15:11:31 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 6c1478d19 -> 69d3af8be


MINOR: fix integer overflow in simple benchmark MB/sec calculation

Author: Damian Guy <damian.guy@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2523 from dguy/minor-streams-bench


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/69d3af8b
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/69d3af8b
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/69d3af8b

Branch: refs/heads/trunk
Commit: 69d3af8be26c8f3abb2c9dfd43d2462d5aa27c69
Parents: 6c1478d
Author: Damian Guy <damian.guy@gmail.com>
Authored: Thu Feb 9 15:11:18 2017 +0000
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Thu Feb 9 15:11:18 2017 +0000

----------------------------------------------------------------------
 .../org/apache/kafka/streams/perf/SimpleBenchmark.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/69d3af8b/streams/src/test/java/org/apache/kafka/streams/perf/SimpleBenchmark.java
----------------------------------------------------------------------
diff --git a/streams/src/test/java/org/apache/kafka/streams/perf/SimpleBenchmark.java b/streams/src/test/java/org/apache/kafka/streams/perf/SimpleBenchmark.java
index baef1e9..29dcf51 100644
--- a/streams/src/test/java/org/apache/kafka/streams/perf/SimpleBenchmark.java
+++ b/streams/src/test/java/org/apache/kafka/streams/perf/SimpleBenchmark.java
@@ -334,7 +334,7 @@ public class SimpleBenchmark {
             processedRecords + "/" +
             latency + "/" +
             recordsPerSec(latency, processedRecords) + "/" +
-            megaBytePerSec(latency, processedRecords, RECORD_SIZE));
+            megabytesPerSec(latency, processedRecords, RECORD_SIZE));
     }
 
     private void runGenericBenchmark(final KafkaStreams streams, final String nameOfBenchmark,
final CountDownLatch latch) {
@@ -488,7 +488,7 @@ public class SimpleBenchmark {
                 numRecords + "/" +
                 (endTime - startTime) + "/" +
                 recordsPerSec(endTime - startTime, numRecords) + "/" +
-                megaBytePerSec(endTime - startTime, numRecords, KEY_SIZE + valueSizeBytes));
+                megabytesPerSec(endTime - startTime, numRecords, KEY_SIZE + valueSizeBytes));
         }
     }
 
@@ -536,7 +536,7 @@ public class SimpleBenchmark {
             consumedRecords + "/" +
             (endTime - startTime) + "/" +
             recordsPerSec(endTime - startTime, consumedRecords) + "/" +
-            megaBytePerSec(endTime - startTime, consumedRecords, RECORD_SIZE));
+            megabytesPerSec(endTime - startTime, consumedRecords, RECORD_SIZE));
     }
 
     private KafkaStreams createKafkaStreams(String topic, final CountDownLatch latch) {
@@ -716,8 +716,8 @@ public class SimpleBenchmark {
     }
 
 
-    private double megaBytePerSec(long time, int numRecords, int recordSizeBytes) {
-        return (double) (recordSizeBytes * numRecords / 1024 / 1024) / ((double) time / 1000);
+    private double megabytesPerSec(long time, int numRecords, int recordSizeBytes) {
+        return  ((double) recordSizeBytes * numRecords / 1024 / 1024) / (time / 1000.0);
     }
 
     private double recordsPerSec(long time, int numRecords) {


Mime
View raw message