From cc33c955e9426619ec59640ef41865563cb75c52 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 9 Sep 2021 14:24:45 +0530 Subject: [PATCH 1/7] - Changes to ignore the fields in json that are null; --- .../benchmarks/tpcc/JsonMetricsHelper.java | 5 ++-- .../benchmarks/tpcc/pojo/TpccRunResults.java | 24 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java index fd53916..d484355 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java @@ -3,8 +3,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.oltpbenchmark.benchmarks.tpcc.pojo.TpccRunResults; -import com.oltpbenchmark.util.LatencyMetricsUtil; import com.oltpbenchmark.util.FileUtil; +import com.oltpbenchmark.util.LatencyMetricsUtil; import org.apache.log4j.Logger; import java.io.File; @@ -219,8 +219,9 @@ public static void mergeJsonResults(String dirPath) { double tpmc = 1.0 * numNewOrder * 60 / mergedTpccResults.TestConfiguration.runTimeInSecs; mergedTpccResults.Results.efficiency = 1.0 * tpmc * 100 / mergedTpccResults.TestConfiguration.numWarehouses / 12.86; mergedTpccResults.Results.tpmc = tpmc; + if(mergedTpccResults.RetryAttempts.size() == 0) mergedTpccResults.RetryAttempts = null; + if(mergedTpccResults.WorkerTaskLatency.size() == 0) mergedTpccResults.WorkerTaskLatency = null; jsonHelper.writeMetricsToJSONFile(); } - } diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java index 6df9395..984cda6 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java @@ -22,13 +22,13 @@ public class TpccRunResults { public class LatencyList { public String Transaction; public int Count; - public double minLatency; - public double avgLatency; - public double maxLatency; - public double P99Latency; - public double connectionAcqLatency; - public double minConnAcqLatency; - public double maxConnAcqLatency; + public Double minLatency = null; + public Double avgLatency; + public Double maxLatency = null; + public Double P99Latency; + public Double connectionAcqLatency; + public Double minConnAcqLatency = null; + public Double maxConnAcqLatency = null; } public class TestConf { @@ -42,11 +42,11 @@ public class TestConf { } public class RunResults { - public double tpmc; - public double efficiency; - public double throughput; - public double throughputMin; - public double throughputMax; + public Double tpmc; + public Double efficiency; + public Double throughput; + public Double throughputMin; + public Double throughputMax; } public class RetryAttemptsData { From 2718779e45b7000912d51c5dbd1517c5c6292903 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Mon, 13 Sep 2021 14:48:34 +0530 Subject: [PATCH 2/7] - Fix in merge results code. --- .../benchmarks/tpcc/JsonMetricsHelper.java | 92 +++++++++++-------- .../benchmarks/tpcc/pojo/TpccRunResults.java | 14 +-- 2 files changed, 63 insertions(+), 43 deletions(-) diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java index d484355..89dbf9f 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java @@ -41,11 +41,11 @@ public void setTestResults(String tpmc, String efficiency, String throughput) { } public void addLatency(String op, List latencyList, List connLatencyList) { - tpccRunResults.Latencies.add(getLatencyValueList(op, latencyList, connLatencyList)); + tpccRunResults.Latencies.put(op,getLatencyValueList(op, latencyList, connLatencyList)); } public void addFailureLatency(String op, List latencyList, List connLatencyList) { - tpccRunResults.FailureLatencies.add(getLatencyValueList(op, latencyList, connLatencyList)); + tpccRunResults.FailureLatencies.put(op,getLatencyValueList(op, latencyList, connLatencyList)); } public void addWorkerTaskLatency(String op, String task, List latencyList) { @@ -55,11 +55,11 @@ public void addWorkerTaskLatency(String op, String task, List latencyLi tpccRunResults.WorkerTaskLatency.get(op).add(getLatencyValueList(task, latencyList, null)); } - public void addRetry(String op, int count,int[] retryOpList) { + public void addRetry(String op, int count, int[] retryOpList) { TpccRunResults.RetryAttemptsData retryObj = tpccRunResults.new RetryAttemptsData(); retryObj.count = count; retryObj.retriesFailureCount = Arrays.asList(retryOpList); - tpccRunResults.RetryAttempts.put(op,retryObj); + tpccRunResults.RetryAttempts.put(op, retryObj); } private TpccRunResults.LatencyList getLatencyValueList(String op, List latencyList, @@ -68,7 +68,7 @@ private TpccRunResults.LatencyList getLatencyValueList(String op, List df.setMaximumFractionDigits(2); df.setGroupingUsed(false); TpccRunResults.LatencyList valueList = tpccRunResults.new LatencyList(); - valueList.Transaction = op; + //valueList.Transaction = op; valueList.Count = latencyList.size(); valueList.avgLatency = Double.parseDouble(df.format(LatencyMetricsUtil.getAverageLatency(latencyList))); valueList.P99Latency = Double.parseDouble(df.format(LatencyMetricsUtil.getP99Latency(latencyList))); @@ -119,8 +119,11 @@ public static void mergeJsonResults(String dirPath) { continue; } try { - listTpccRunResults.add(gson.fromJson( - new String(Files.readAllBytes(Paths.get(file))), TpccRunResults.class)); + file = dirPath + File.separator + file; + if (new File(file).isFile()) { + listTpccRunResults.add(gson.fromJson( + new String(Files.readAllBytes(Paths.get(file))), TpccRunResults.class)); + } } catch (IOException ie) { LOG.error("Got exception while reading json file - " + file + " : ", ie); return; @@ -132,35 +135,44 @@ public static void mergeJsonResults(String dirPath) { for (TpccRunResults tpccResult : listTpccRunResults) { mergedTpccResults.TestConfiguration = tpccResult.TestConfiguration; - if(filesMergedIdx == 0) { + if (filesMergedIdx == 0) { mergedTpccResults.Results.throughputMin = tpccResult.Results.throughput; mergedTpccResults.Results.throughputMax = tpccResult.Results.throughput; + mergedTpccResults.Results.throughput = tpccResult.Results.throughput; + } else { if (mergedTpccResults.Results.throughputMin > tpccResult.Results.throughput) mergedTpccResults.Results.throughputMin = tpccResult.Results.throughput; if (mergedTpccResults.Results.throughputMax < tpccResult.Results.throughput) mergedTpccResults.Results.throughputMax = tpccResult.Results.throughput; + mergedTpccResults.Results.throughput = computeAverage(mergedTpccResults.Results.throughput, + tpccResult.Results.throughput, filesMergedIdx); } - mergedTpccResults.Results.throughput = computeAverage(mergedTpccResults.Results.throughput, - tpccResult.Results.throughput, filesMergedIdx); - List latList = tpccResult.Latencies; - for (int i = 0; i < latList.size() ; i++) { - TpccRunResults.LatencyList opLatency = latList.get(i); + Map latList = tpccResult.Latencies; + for (Map.Entry entry : latList.entrySet()) { + String op = entry.getKey(); + TpccRunResults.LatencyList opLatency = entry.getValue(); TpccRunResults.LatencyList latency; - if(opLatency.Transaction.equalsIgnoreCase("NewOrder")) + if (op.equalsIgnoreCase("NewOrder")) numNewOrder += opLatency.Count; - if(mergedTpccResults.Latencies.size() <= i) { + + if (!mergedTpccResults.Latencies.containsKey(op)) { latency = mergedTpccResults.new LatencyList(); - latency.Transaction = opLatency.Transaction; + latency.avgLatency = opLatency.avgLatency; latency.minLatency = opLatency.avgLatency; latency.maxLatency = opLatency.avgLatency; latency.P99Latency = opLatency.P99Latency; + latency.connectionAcqLatency = opLatency.connectionAcqLatency; latency.minConnAcqLatency = opLatency.connectionAcqLatency; latency.maxConnAcqLatency = opLatency.connectionAcqLatency; - mergedTpccResults.Latencies.add(latency); + mergedTpccResults.Latencies.put(op,latency); } else { - latency = mergedTpccResults.Latencies.get(i); + latency = mergedTpccResults.Latencies.get(op); + latency.avgLatency = computeAverage(latency.avgLatency, + opLatency.avgLatency, filesMergedIdx); + latency.connectionAcqLatency = computeAverage(latency.connectionAcqLatency, + opLatency.connectionAcqLatency, filesMergedIdx); latency.minLatency = latency.minLatency > opLatency.avgLatency ? opLatency.avgLatency : latency.minLatency; latency.maxLatency = latency.maxLatency < opLatency.avgLatency ? @@ -172,28 +184,25 @@ public static void mergeJsonResults(String dirPath) { latency.maxConnAcqLatency = latency.maxConnAcqLatency < opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : latency.maxConnAcqLatency; } - latency.Count += opLatency.Count; - latency.avgLatency = computeAverage(latency.avgLatency, opLatency.avgLatency, filesMergedIdx); - latency.connectionAcqLatency = computeAverage(latency.connectionAcqLatency, - opLatency.connectionAcqLatency, filesMergedIdx); - mergedTpccResults.Latencies.set(i, latency); + latency.Count += opLatency.Count; + mergedTpccResults.Latencies.put(op, latency); } - List failureLatList = tpccResult.FailureLatencies; - for (int i = 0; i < failureLatList.size() ; i++) { - TpccRunResults.LatencyList opLatency = failureLatList.get(i); + Map failureLatList = tpccResult.FailureLatencies; + for (Map.Entry entry : failureLatList.entrySet()) { + String op = entry.getKey(); + TpccRunResults.LatencyList opLatency = entry.getValue(); TpccRunResults.LatencyList failureLat; - if (mergedTpccResults.FailureLatencies.size() <= i) { + if (mergedTpccResults.FailureLatencies.containsKey(op)) { failureLat = mergedTpccResults.new LatencyList(); - failureLat.Transaction = opLatency.Transaction; failureLat.minLatency = opLatency.avgLatency; failureLat.maxLatency = opLatency.avgLatency; failureLat.P99Latency = opLatency.P99Latency; failureLat.minConnAcqLatency = opLatency.connectionAcqLatency; failureLat.maxConnAcqLatency = opLatency.connectionAcqLatency; - mergedTpccResults.FailureLatencies.add(failureLat); + mergedTpccResults.FailureLatencies.put(op, failureLat); } else { - failureLat = mergedTpccResults.FailureLatencies.get(i); + failureLat = mergedTpccResults.FailureLatencies.get(op); failureLat.minLatency = failureLat.minLatency > opLatency.avgLatency ? opLatency.avgLatency : failureLat.minLatency; failureLat.maxLatency = failureLat.maxLatency < opLatency.avgLatency ? @@ -205,11 +214,17 @@ public static void mergeJsonResults(String dirPath) { failureLat.maxConnAcqLatency = failureLat.maxConnAcqLatency < opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : failureLat.maxConnAcqLatency; } + failureLat.Count += opLatency.Count; - failureLat.avgLatency = computeAverage(failureLat.avgLatency, opLatency.avgLatency, filesMergedIdx); - failureLat.connectionAcqLatency = computeAverage(failureLat.connectionAcqLatency, - opLatency.connectionAcqLatency, filesMergedIdx); - mergedTpccResults.FailureLatencies.set(i, failureLat); + if (failureLat.avgLatency != null) { + failureLat.avgLatency = computeAverage(failureLat.avgLatency, + opLatency.avgLatency, filesMergedIdx); + } else failureLat.avgLatency = opLatency.avgLatency; + if (failureLat.connectionAcqLatency != null) { + failureLat.connectionAcqLatency = computeAverage(failureLat.connectionAcqLatency, + opLatency.connectionAcqLatency, filesMergedIdx); + } else failureLat.connectionAcqLatency = opLatency.connectionAcqLatency; + mergedTpccResults.FailureLatencies.put(op, failureLat); } filesMergedIdx++; } @@ -219,9 +234,14 @@ public static void mergeJsonResults(String dirPath) { double tpmc = 1.0 * numNewOrder * 60 / mergedTpccResults.TestConfiguration.runTimeInSecs; mergedTpccResults.Results.efficiency = 1.0 * tpmc * 100 / mergedTpccResults.TestConfiguration.numWarehouses / 12.86; mergedTpccResults.Results.tpmc = tpmc; - if(mergedTpccResults.RetryAttempts.size() == 0) mergedTpccResults.RetryAttempts = null; - if(mergedTpccResults.WorkerTaskLatency.size() == 0) mergedTpccResults.WorkerTaskLatency = null; + if (mergedTpccResults.RetryAttempts.size() == 0) mergedTpccResults.RetryAttempts = null; + if (mergedTpccResults.WorkerTaskLatency.size() == 0) + mergedTpccResults.WorkerTaskLatency = null; jsonHelper.writeMetricsToJSONFile(); } + + public static void main(String[] args) { + mergeJsonResults(args[0]); + } } diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java index 984cda6..1a81fc0 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java @@ -11,24 +11,24 @@ public class TpccRunResults { public RunResults Results = new RunResults(); - public List Latencies = new ArrayList<>(); + public Map Latencies = new LinkedHashMap<>(); - public List FailureLatencies = new ArrayList<>(); + public Map FailureLatencies = new LinkedHashMap<>(); public Map> WorkerTaskLatency = new LinkedHashMap<>(); public Map RetryAttempts = new LinkedHashMap<>(); public class LatencyList { - public String Transaction; + //public String Transaction; public int Count; - public Double minLatency = null; public Double avgLatency; - public Double maxLatency = null; + public Double minLatency; + public Double maxLatency; public Double P99Latency; public Double connectionAcqLatency; - public Double minConnAcqLatency = null; - public Double maxConnAcqLatency = null; + public Double minConnAcqLatency; + public Double maxConnAcqLatency; } public class TestConf { From a0200acb9e500c887fb127d4b55ae2de44f1814d Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 18 Aug 2022 12:27:50 +0530 Subject: [PATCH 3/7] - fixes in json merge results. --- src/com/oltpbenchmark/CommandLineOptions.java | 2 ++ src/com/oltpbenchmark/DBWorkload.java | 10 ++++++++-- .../benchmarks/tpcc/pojo/TpccRunResults.java | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/oltpbenchmark/CommandLineOptions.java b/src/com/oltpbenchmark/CommandLineOptions.java index 2f24b6e..5dcd0ee 100644 --- a/src/com/oltpbenchmark/CommandLineOptions.java +++ b/src/com/oltpbenchmark/CommandLineOptions.java @@ -77,6 +77,7 @@ public enum Mode { LOAD, EXECUTE, MERGE_RESULTS, + MERGE_JSON_RESULTS, ENABLE_FOREIGN_KEYS, CREATE_SQL_PROCEDURES, } @@ -102,6 +103,7 @@ public Mode getMode() { if (isBooleanOptionSet("execute")) return Mode.EXECUTE; if (isBooleanOptionSet("enable-foreign-keys")) return Mode.ENABLE_FOREIGN_KEYS; if (isBooleanOptionSet("create-sql-procedures")) return Mode.CREATE_SQL_PROCEDURES; + if (isBooleanOptionSet("merge-json-results")) return Mode.MERGE_JSON_RESULTS; assert isBooleanOptionSet("merge-results"); return Mode.MERGE_RESULTS; } diff --git a/src/com/oltpbenchmark/DBWorkload.java b/src/com/oltpbenchmark/DBWorkload.java index 5dd26d8..0f82e97 100644 --- a/src/com/oltpbenchmark/DBWorkload.java +++ b/src/com/oltpbenchmark/DBWorkload.java @@ -92,6 +92,13 @@ public static void main(String[] args) throws Exception { return; } + if (options.getMode() == CommandLineOptions.Mode.MERGE_JSON_RESULTS) { + String dirPath = options.getDirPath().orElseThrow(() -> + new RuntimeException("Must specify directory with json results to merge with --dir={directory path}")); + JsonMetricsHelper.mergeJsonResults(dirPath); + return; + } + if (options.getMode() == CommandLineOptions.Mode.MERGE_RESULTS) { String dirPath = options.getDirPath().orElseThrow(() -> new RuntimeException("Must specify directory with results to merge with --dir={directory path}")); @@ -298,7 +305,7 @@ public static void main(String[] args) throws Exception { terminals, Phase.Arrival.REGULAR); - jsonMetricsHelper.setTestConfig(nodes.size(),numWarehouses, numDBConnections, + jsonMetricsHelper.setTestConfig(nodes.size(), totalWarehousesAcrossShards, numWarehouses, numDBConnections, warmupTime, time, wrkld.getMaxRetriesPerTransaction()); // CHECKING INPUT PHASES int j = 0; @@ -847,7 +854,6 @@ public static void mergeResults(String dirPath, String[] fileNames) { LOG.info(getOperationLatencyString(transactionTypes.get(i+1), list_latencies.get(i))); } - JsonMetricsHelper.mergeJsonResults(dirPath); } public static String getAssertWarning() { diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java index 6df9395..b704433 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java @@ -33,6 +33,7 @@ public class LatencyList { public class TestConf { public int numNodes; + public int totalWarehouses; public int numWarehouses; public int numDBConnections; public int warmupTimeInSecs; From c4827cd9b8ad2889aae14ea8f10832d3bae060a4 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 18 Aug 2022 12:30:40 +0530 Subject: [PATCH 4/7] - changes for the JsonMetricsHelper class --- .../benchmarks/tpcc/JsonMetricsHelper.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java index fd53916..dde502c 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java @@ -24,8 +24,9 @@ public JsonMetricsHelper() { tpccRunResults = new TpccRunResults(); } - public void setTestConfig(int numNodes, int numWH, int numDBConn, int warmuptime, int runtime, int numRetries) { + public void setTestConfig(int numNodes, int totalWH, int numWH, int numDBConn, int warmuptime, int runtime, int numRetries ) { tpccRunResults.TestConfiguration.numNodes = numNodes; + tpccRunResults.TestConfiguration.totalWarehouses = totalWH; tpccRunResults.TestConfiguration.numWarehouses = numWH; tpccRunResults.TestConfiguration.numDBConnections = numDBConn; tpccRunResults.TestConfiguration.warmupTimeInSecs = warmuptime; @@ -102,7 +103,10 @@ public void writeMetricsToJSONFile() { } private static double computeAverage(double old_value, double newValue, int count) { - return ((old_value * count) + newValue) / (count + 1); + DecimalFormat df = new DecimalFormat(); + df.setMaximumFractionDigits(2); + df.setGroupingUsed(false); + return Double.parseDouble(df.format(((old_value * count) + newValue) / (count + 1))); } /* @@ -119,8 +123,11 @@ public static void mergeJsonResults(String dirPath) { continue; } try { - listTpccRunResults.add(gson.fromJson( - new String(Files.readAllBytes(Paths.get(file))), TpccRunResults.class)); + file = dirPath + File.separator + file; + if (new File(file).isFile()) { + listTpccRunResults.add(gson.fromJson( + new String(Files.readAllBytes(Paths.get(file))), TpccRunResults.class)); + } } catch (IOException ie) { LOG.error("Got exception while reading json file - " + file + " : ", ie); return; @@ -129,8 +136,12 @@ public static void mergeJsonResults(String dirPath) { int numNewOrder = 0; int filesMergedIdx = 0; + boolean firstFile = true; for (TpccRunResults tpccResult : listTpccRunResults) { - mergedTpccResults.TestConfiguration = tpccResult.TestConfiguration; + if(firstFile){ + mergedTpccResults.TestConfiguration = tpccResult.TestConfiguration; + firstFile = false; + } if(filesMergedIdx == 0) { mergedTpccResults.Results.throughputMin = tpccResult.Results.throughput; @@ -217,7 +228,7 @@ public static void mergeJsonResults(String dirPath) { JsonMetricsHelper jsonHelper = new JsonMetricsHelper(); jsonHelper.tpccRunResults = mergedTpccResults; double tpmc = 1.0 * numNewOrder * 60 / mergedTpccResults.TestConfiguration.runTimeInSecs; - mergedTpccResults.Results.efficiency = 1.0 * tpmc * 100 / mergedTpccResults.TestConfiguration.numWarehouses / 12.86; + mergedTpccResults.Results.efficiency = 1.0 * tpmc * 100 / mergedTpccResults.TestConfiguration.totalWarehouses / 12.86; mergedTpccResults.Results.tpmc = tpmc; jsonHelper.writeMetricsToJSONFile(); From c9cb0b7554ad71a7382445370a139753db927d69 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 18 Aug 2022 13:30:09 +0530 Subject: [PATCH 5/7] - adding cmdline option for merge-json-results --- src/com/oltpbenchmark/CommandLineOptions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/oltpbenchmark/CommandLineOptions.java b/src/com/oltpbenchmark/CommandLineOptions.java index 5dcd0ee..4f70fde 100644 --- a/src/com/oltpbenchmark/CommandLineOptions.java +++ b/src/com/oltpbenchmark/CommandLineOptions.java @@ -64,6 +64,7 @@ public class CommandLineOptions { "Delay in seconds for starting the benchmark"); COMMAND_LINE_OPTS.addOption(null, "num-connections", true, "Number of connections used"); COMMAND_LINE_OPTS.addOption(null, "merge-results", true, "Merge results from various output files"); + COMMAND_LINE_OPTS.addOption(null, "merge-json-results", true, "Merge results from various json output files"); COMMAND_LINE_OPTS.addOption(null, "dir", true, "Directory containing the csv files"); COMMAND_LINE_OPTS.addOption(null, "vv", false, "Output verbose execute results"); } From 8cc8990d28af26e6cce20526ba792afcf5b3c683 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 18 Aug 2022 16:43:21 +0530 Subject: [PATCH 6/7] - some fixes --- .../benchmarks/tpcc/JsonMetricsHelper.java | 13 +++++++------ .../benchmarks/tpcc/pojo/TpccRunResults.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java index 192b42a..a93064d 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java @@ -42,11 +42,11 @@ public void setTestResults(String tpmc, String efficiency, String throughput) { } public void addLatency(String op, List latencyList, List connLatencyList) { - tpccRunResults.Latencies.put(op,getLatencyValueList(op, latencyList, connLatencyList)); + tpccRunResults.Latencies.put(op,getLatencyValueList(null, latencyList, connLatencyList)); } public void addFailureLatency(String op, List latencyList, List connLatencyList) { - tpccRunResults.FailureLatencies.put(op,getLatencyValueList(op, latencyList, connLatencyList)); + tpccRunResults.FailureLatencies.put(op,getLatencyValueList(null, latencyList, connLatencyList)); } public void addWorkerTaskLatency(String op, String task, List latencyList) { @@ -63,13 +63,13 @@ public void addRetry(String op, int count, int[] retryOpList) { tpccRunResults.RetryAttempts.put(op, retryObj); } - private TpccRunResults.LatencyList getLatencyValueList(String op, List latencyList, + private TpccRunResults.LatencyList getLatencyValueList(String task, List latencyList, List connAcqLatencyList) { DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(2); df.setGroupingUsed(false); TpccRunResults.LatencyList valueList = tpccRunResults.new LatencyList(); - //valueList.Transaction = op; + valueList.WorkerTask = task; valueList.Count = latencyList.size(); valueList.avgLatency = Double.parseDouble(df.format(LatencyMetricsUtil.getAverageLatency(latencyList))); valueList.P99Latency = Double.parseDouble(df.format(LatencyMetricsUtil.getP99Latency(latencyList))); @@ -79,6 +79,7 @@ private TpccRunResults.LatencyList getLatencyValueList(String op, List return valueList; } + /* Writes the Json object to a JSON file */ public void writeMetricsToJSONFile() { String outputDirectory = "results/json"; @@ -185,7 +186,7 @@ public static void mergeJsonResults(String dirPath) { opLatency.avgLatency : latency.minLatency; latency.maxLatency = latency.maxLatency < opLatency.avgLatency ? opLatency.avgLatency : latency.maxLatency; - latency.P99Latency = latency.P99Latency > opLatency.P99Latency ? + latency.P99Latency = latency.P99Latency < opLatency.P99Latency ? opLatency.P99Latency : latency.P99Latency; latency.minConnAcqLatency = latency.minConnAcqLatency > opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : latency.minConnAcqLatency; @@ -215,7 +216,7 @@ public static void mergeJsonResults(String dirPath) { opLatency.avgLatency : failureLat.minLatency; failureLat.maxLatency = failureLat.maxLatency < opLatency.avgLatency ? opLatency.avgLatency : failureLat.maxLatency; - failureLat.P99Latency = failureLat.P99Latency > opLatency.P99Latency ? + failureLat.P99Latency = failureLat.P99Latency < opLatency.P99Latency ? opLatency.P99Latency : failureLat.P99Latency; failureLat.minConnAcqLatency = failureLat.minConnAcqLatency > opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : failureLat.minConnAcqLatency; diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java index 7e75816..380ebcc 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java @@ -20,7 +20,7 @@ public class TpccRunResults { public Map RetryAttempts = new LinkedHashMap<>(); public class LatencyList { - //public String Transaction; + public String WorkerTask; public int Count; public Double avgLatency; public Double minLatency; From 4eea9a5f1888e1279fe928278622416f6d5125c0 Mon Sep 17 00:00:00 2001 From: Sonal Agarwal Date: Thu, 18 Aug 2022 19:59:42 +0530 Subject: [PATCH 7/7] - minor fixes --- .../benchmarks/tpcc/JsonMetricsHelper.java | 4 ++-- .../benchmarks/tpcc/pojo/TpccRunResults.java | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java index dde502c..48d40eb 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/JsonMetricsHelper.java @@ -176,7 +176,7 @@ public static void mergeJsonResults(String dirPath) { opLatency.avgLatency : latency.minLatency; latency.maxLatency = latency.maxLatency < opLatency.avgLatency ? opLatency.avgLatency : latency.maxLatency; - latency.P99Latency = latency.P99Latency > opLatency.P99Latency ? + latency.P99Latency = latency.P99Latency < opLatency.P99Latency ? opLatency.P99Latency : latency.P99Latency; latency.minConnAcqLatency = latency.minConnAcqLatency > opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : latency.minConnAcqLatency; @@ -209,7 +209,7 @@ public static void mergeJsonResults(String dirPath) { opLatency.avgLatency : failureLat.minLatency; failureLat.maxLatency = failureLat.maxLatency < opLatency.avgLatency ? opLatency.avgLatency : failureLat.maxLatency; - failureLat.P99Latency = failureLat.P99Latency > opLatency.P99Latency ? + failureLat.P99Latency = failureLat.P99Latency < opLatency.P99Latency ? opLatency.P99Latency : failureLat.P99Latency; failureLat.minConnAcqLatency = failureLat.minConnAcqLatency > opLatency.connectionAcqLatency ? opLatency.connectionAcqLatency : failureLat.minConnAcqLatency; diff --git a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java index b704433..e5a87d0 100644 --- a/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java +++ b/src/com/oltpbenchmark/benchmarks/tpcc/pojo/TpccRunResults.java @@ -22,13 +22,13 @@ public class TpccRunResults { public class LatencyList { public String Transaction; public int Count; - public double minLatency; - public double avgLatency; - public double maxLatency; - public double P99Latency; - public double connectionAcqLatency; - public double minConnAcqLatency; - public double maxConnAcqLatency; + public Double minLatency; + public Double avgLatency; + public Double maxLatency; + public Double P99Latency; + public Double connectionAcqLatency; + public Double minConnAcqLatency; + public Double maxConnAcqLatency; } public class TestConf { @@ -43,11 +43,11 @@ public class TestConf { } public class RunResults { - public double tpmc; - public double efficiency; - public double throughput; - public double throughputMin; - public double throughputMax; + public Double tpmc; + public Double efficiency; + public Double throughput; + public Double throughputMin; + public Double throughputMax; } public class RetryAttemptsData {