pivotal-jbarrett commented on a change in pull request #94: Configurable client 
thread count
URL: https://github.com/apache/geode-benchmarks/pull/94#discussion_r318339660
 
 

 ##########
 File path: 
geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/TestConfigFactory.java
 ##########
 @@ -17,32 +17,38 @@
 
 import static java.util.concurrent.TimeUnit.MINUTES;
 
+import java.util.Properties;
+
+import com.google.common.base.Strings;
+
 import org.apache.geode.perftest.TestConfig;
 
-public class GeodeBenchmark {
+public class TestConfigFactory {
 
-  /**
-   * Warm up time for the benchmark running on the default runner
-   */
   private static final long WARM_UP_TIME = MINUTES.toSeconds(1);
-
-  /**
-   * Total duration for which the benchmark will run on the default runner
-   */
   private static final long BENCHMARK_DURATION = MINUTES.toSeconds(5);
 
-  /**
-   * Number of threads to run benchmark.
-   */
-  private static final int THREADS = 
Runtime.getRuntime().availableProcessors() * 16;
-
+  private int defaultThreadCount;
 
-  public static TestConfig createConfig() {
+  public TestConfig build() {
     TestConfig testConfig = new TestConfig();
     testConfig.warmupSeconds(WARM_UP_TIME);
     testConfig.durationSeconds(BENCHMARK_DURATION);
-    testConfig.threads(THREADS);
+    testConfig.threads(numThreads());
     return testConfig;
+
+  }
+
+  public TestConfigFactory withDefaultThreadCount(int defaultThreadCount) {
+    this.defaultThreadCount = defaultThreadCount;
+    return this;
   }
 
+  private int numThreads() {
+    Properties properties = System.getProperties();
+    if (Strings.isNullOrEmpty(properties.getProperty("clientThreadCount"))) {
 
 Review comment:
   System properties supports a default value. 
   ```
   return Integer.getInteger("clientThreadCount", defaultThreadCount);
   ```
   
https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#getInteger-java.lang.String-int-

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to