forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BENCHMARK: Add Workercount and Batch size as configurable settings in…
… benchmark Fixes elastic#8217
- Loading branch information
1 parent
44e68b4
commit 777df44
Showing
8 changed files
with
186 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tools/benchmark-cli/src/main/java/org/logstash/benchmark/cli/BenchmarkMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.logstash.benchmark.cli; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.apache.commons.lang3.SystemUtils; | ||
import org.logstash.benchmark.cli.ui.LsVersionType; | ||
|
||
public final class BenchmarkMeta { | ||
|
||
private final String testcase; | ||
|
||
private final String version; | ||
|
||
private final LsVersionType vtype; | ||
|
||
private final int workers; | ||
|
||
private final int batchsize; | ||
|
||
BenchmarkMeta(final String testcase, final String version, final LsVersionType vtype, | ||
final int workers, final int batchsize) { | ||
this.testcase = testcase; | ||
this.version = version; | ||
this.vtype = vtype; | ||
this.workers = workers; | ||
this.batchsize = batchsize; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public String getTestcase() { | ||
return testcase; | ||
} | ||
|
||
public LsVersionType getVtype() { | ||
return vtype; | ||
} | ||
|
||
public int getWorkers() { | ||
return workers; | ||
} | ||
|
||
public int getBatchsize() { | ||
return batchsize; | ||
} | ||
|
||
public Map<String, Object> asMap() { | ||
final Map<String, Object> result = new HashMap<>(); | ||
result.put("test_name", testcase); | ||
result.put("os_name", SystemUtils.OS_NAME); | ||
result.put("os_version", SystemUtils.OS_VERSION); | ||
try { | ||
result.put("host_name", InetAddress.getLocalHost().getHostName()); | ||
} catch (final UnknownHostException ex) { | ||
throw new IllegalStateException(ex); | ||
} | ||
result.put("cpu_cores", Runtime.getRuntime().availableProcessors()); | ||
result.put("version_type", vtype); | ||
result.put("version", version); | ||
result.put("batch_size", batchsize); | ||
result.put("worker_threads", workers); | ||
return Collections.unmodifiableMap(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.