Return-Path: X-Original-To: apmail-asterixdb-commits-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8419F1936E for ; Wed, 16 Mar 2016 00:35:17 +0000 (UTC) Received: (qmail 79948 invoked by uid 500); 16 Mar 2016 00:35:17 -0000 Delivered-To: apmail-asterixdb-commits-archive@asterixdb.apache.org Received: (qmail 79911 invoked by uid 500); 16 Mar 2016 00:35:17 -0000 Mailing-List: contact commits-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list commits@asterixdb.incubator.apache.org Received: (qmail 79901 invoked by uid 99); 16 Mar 2016 00:35:17 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Mar 2016 00:35:17 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id ABD101A0230 for ; Wed, 16 Mar 2016 00:35:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.549 X-Spam-Level: X-Spam-Status: No, score=-3.549 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id AL93c91Id1OR for ; Wed, 16 Mar 2016 00:35:09 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 3FB995FC04 for ; Wed, 16 Mar 2016 00:35:07 +0000 (UTC) Received: (qmail 79728 invoked by uid 99); 16 Mar 2016 00:35:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Mar 2016 00:35:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 52ED2E01BA; Wed, 16 Mar 2016 00:35:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: imaxon@apache.org To: commits@asterixdb.incubator.apache.org Date: Wed, 16 Mar 2016 00:35:13 -0000 Message-Id: <0f74dba9554e41288846f3dda8b31768@git.apache.org> In-Reply-To: <8da4df9d29484b328c8258c8d8f06317@git.apache.org> References: <8da4df9d29484b328c8258c8d8f06317@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/15] incubator-asterixdb git commit: Merge asterix-experiments to master http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a70fba5c/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilder.java ---------------------------------------------------------------------- diff --git a/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilder.java b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilder.java new file mode 100644 index 0000000..52034a4 --- /dev/null +++ b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilder.java @@ -0,0 +1,264 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.asterix.experiment.report; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class SIE2ReportBuilder extends AbstractDynamicDataEvalReportBuilder { + private static final int SELECT_QUERY_RADIUS_COUNT = 5; + private static final int INITIAL_SELECT_QUERY_COUNT_TO_IGNORE = 0; + private static final int MAX_SELECT_QUERY_COUNT_TO_CONSIDER = Integer.MAX_VALUE; //5000 + INITIAL_SELECT_QUERY_COUNT_TO_CONSIDER; + private static final int QUERY_GEN_COUNT = 8; + private static final String[] QUERY_GEN_IPS = { "130.149.249.61", "130.149.249.62", "130.149.249.63", + "130.149.249.64", "130.149.249.65", "130.149.249.66", "130.149.249.67", "130.149.249.68" }; + private BufferedReader[] queryLogFileBrs; + + public SIE2ReportBuilder(String expHomePath, String expName, String runLogFileName) { + super(expHomePath, expName, runLogFileName, false); + queryLogFileBrs = new BufferedReader[QUERY_GEN_COUNT]; + } + + @Override + public String getOverallInsertPS(int minutes) throws Exception { + return null; + } + + public String get20minInsertPS(int minutes) throws Exception { + renewStringBuilder(); + openRunLog(); + try { + if (!moveToExperimentBegin()) { + //The experiment run log doesn't exist in this run log file + return null; + } + + String line; + long insertCount = 0; + while ((line = br.readLine()) != null) { + if (line.contains("[During ingestion + queries][InsertCount]")) { + insertCount += ReportBuilderHelper.getLong(line, "=", "in"); + } + if (line.contains("Running")) { + break; + } + } + rsb.append(insertCount / (minutes * 60)); + return rsb.toString(); + } finally { + closeRunLog(); + } + } + + public double getFirstXminInsertPS(int minutes, int genId, int unitMinutes) throws Exception { + renewStringBuilder(); + openRunLog(); + try { + if (!moveToExperimentBegin()) { + //The experiment run log doesn't exist in this run log file + return 0; + } + + String line; + int dGenId; + int count = 0; + long timeToInsert = 0; + long totalTimeToInsert = 0; + boolean haveResult = false; + while ((line = br.readLine()) != null) { + if (line.contains("[During ingestion only][TimeToInsert100000]")) { + dGenId = ReportBuilderHelper.getInt(line, "DataGen[", "]"); + if (dGenId == genId) { + count++; + timeToInsert = ReportBuilderHelper.getLong(line, INSTANTANEOUS_INSERT_STRING, "in"); + totalTimeToInsert += timeToInsert; + if (totalTimeToInsert > minutes * 60000) { + haveResult = true; + break; + } + } + } + if (line.contains("Running")) { + break; + } + } + if (haveResult || totalTimeToInsert > (minutes * 60000 - unitMinutes * 60000)) { + return (count * INSTANTAEOUS_INSERT_COUNT) / ((double) totalTimeToInsert / 1000); + } else { + return 0; + //return ((count * INSTANTAEOUS_INSERT_COUNT) / ((double)totalTimeToInsert/1000)) * -1; + } + } finally { + closeRunLog(); + } + } + + @Override + public String getInstantaneousQueryPS() throws Exception { + return null; + } + + @Override + public String getQueryPS(int minutes) throws Exception { + renewStringBuilder(); + openRunLog(); + try { + if (!moveToExperimentBegin()) { + //The experiment run log doesn't exist in this run log file + return null; + } + + String line; + long queryCount = 0; + while ((line = br.readLine()) != null) { + if (line.contains("[QueryCount]")) { + queryCount += ReportBuilderHelper.getLong(line, "[QueryCount]", "in"); + } + if (line.contains("Running")) { + break; + } + } + rsb.append(queryCount / (float) (minutes * 60)); + return rsb.toString(); + } finally { + closeRunLog(); + } + } + + public String getAverageQueryResultCount() throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + String line; + long resultCount = 0; + long queryCount = 0; + for (BufferedReader queryLogFileBr : queryLogFileBrs) { + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains("int64")) { + line = queryLogFileBr.readLine(); + resultCount += Long.parseLong(line); + ++queryCount; + } + } + } + rsb.append(resultCount / queryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getAverageQueryResponseTime() throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + String line; + long responseTime = 0; + long queryCount = 0; + for (BufferedReader queryLogFileBr : queryLogFileBrs) { + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains("Elapsed time = ")) { + responseTime += ReportBuilderHelper.getLong(line, "=", "for"); + ++queryCount; + } + } + } + rsb.append(responseTime / queryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getSelectQueryResponseTime(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + String line; + long queryResponseTime = 0; + int targetRadiusSelectQueryCount = 0; + for (BufferedReader queryLogFileBr : queryLogFileBrs) { + int selectQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains("Elapsed time =") && selectQueryCount < MAX_SELECT_QUERY_COUNT_TO_CONSIDER) { + if (selectQueryCount % SELECT_QUERY_RADIUS_COUNT == radiusIdx + && selectQueryCount >= INITIAL_SELECT_QUERY_COUNT_TO_IGNORE) { + queryResponseTime += ReportBuilderHelper.getLong(line, "=", "for"); + ++targetRadiusSelectQueryCount; + } + ++selectQueryCount; + } + } + } + rsb.append((double) queryResponseTime / targetRadiusSelectQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getSelectQueryResultCount(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + String line; + long queryResultCount = 0; + int targetRadiusSelectQueryCount = 0; + for (BufferedReader queryLogFileBr : queryLogFileBrs) { + int selectQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains("int64") && selectQueryCount < MAX_SELECT_QUERY_COUNT_TO_CONSIDER) { + if (selectQueryCount % SELECT_QUERY_RADIUS_COUNT == radiusIdx + && selectQueryCount >= INITIAL_SELECT_QUERY_COUNT_TO_IGNORE) { + line = queryLogFileBr.readLine(); //read the result count line + queryResultCount += Long.parseLong(line); + ++targetRadiusSelectQueryCount; + } + ++selectQueryCount; + } + } + } + rsb.append((double) queryResultCount / targetRadiusSelectQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + private void openQueryLog() throws IOException { + String queryLogFilePathPrefix = expHomePath + File.separator + expName + File.separator + "QueryGenResult-"; + String queryLogFilePathSuffix = ".txt"; + for (int i = 0; i < QUERY_GEN_COUNT; i++) { + queryLogFileBrs[i] = new BufferedReader(new FileReader(queryLogFilePathPrefix + QUERY_GEN_IPS[i] + + queryLogFilePathSuffix)); + } + } + + private void closeQueryLog() throws IOException { + for (BufferedReader queryLogFileBr : queryLogFileBrs) { + if (queryLogFileBr != null) { + queryLogFileBr.close(); + queryLogFileBr = null; + } + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a70fba5c/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilderRunner.java ---------------------------------------------------------------------- diff --git a/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilderRunner.java b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilderRunner.java new file mode 100644 index 0000000..91f30f5 --- /dev/null +++ b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE2ReportBuilderRunner.java @@ -0,0 +1,459 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.asterix.experiment.report; + +import java.io.FileOutputStream; +import java.util.ArrayList; + +public class SIE2ReportBuilderRunner { + String expHomePath = "/Users/kisskys/workspace/asterix_master/resultLog/MemBuf3g-DiskBuf3g-Lsev-Jvm7g-Lock0g/exp2-4/"; + String runLogFileName = "run-exp2-4.log"; + String outputFilePath = "/Users/kisskys/workspace/asterix_master/resultLog/MemBuf3g-DiskBuf3g-Lsev-Jvm7g-Lock0g/result-report/"; + + SIE2ReportBuilder sie2Dhbtree = new SIE2ReportBuilder(expHomePath, "SpatialIndexExperiment2Dhbtree", runLogFileName); + SIE2ReportBuilder sie2Dhvbtree = new SIE2ReportBuilder(expHomePath, "SpatialIndexExperiment2Dhvbtree", + runLogFileName); + SIE2ReportBuilder sie2Rtree = new SIE2ReportBuilder(expHomePath, "SpatialIndexExperiment2Rtree", runLogFileName); + SIE2ReportBuilder sie2Shbtree = new SIE2ReportBuilder(expHomePath, "SpatialIndexExperiment2Shbtree", runLogFileName); + SIE2ReportBuilder sie2Sif = new SIE2ReportBuilder(expHomePath, "SpatialIndexExperiment2Sif", runLogFileName); + + StringBuilder sb = new StringBuilder(); + + /** + * generate sie2_overall_insert_ps.txt + */ + public void generateOverallInsertPS() throws Exception { + int targetRound = 721; //(3600 seconds / 5seconds) + 1 + + ArrayList ipsListDhbtree = new ArrayList(); + ArrayList ipsListDhvbtree = new ArrayList(); + ArrayList ipsListRtree = new ArrayList(); + ArrayList ipsListShbtree = new ArrayList(); + ArrayList ipsListSif = new ArrayList(); + sie2Dhbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListDhbtree); + sie2Dhvbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListDhvbtree); + sie2Rtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListRtree); + sie2Shbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListShbtree); + sie2Sif.getAllNodesAccumulatedInsertPS(targetRound, ipsListSif); + + sb.setLength(0); + sb.append("# sie2 60min inserts per second report\n"); + sb.append("index type, InsertPS\n"); + sb.append("dhbtree,").append(ipsListDhbtree.get(targetRound - 1)).append("\n"); + sb.append("dhvbtree,").append(ipsListDhvbtree.get(targetRound - 1)).append("\n"); + sb.append("rtree,").append(ipsListRtree.get(targetRound - 1)).append("\n"); + sb.append("shbtree,").append(ipsListShbtree.get(targetRound - 1)).append("\n"); + sb.append("sif,").append(ipsListSif.get(targetRound - 1)).append("\n"); + + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_overall_insert_ps.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + ipsListDhbtree.clear(); + ipsListDhvbtree.clear(); + ipsListRtree.clear(); + ipsListShbtree.clear(); + ipsListSif.clear(); + } + + /** + * generate sie2_accumulated_insert_ps.txt + */ + public void generateAccumulatedInsertPS() throws Exception { + int targetRound = 721; //(3600 seconds / 5seconds) + 1 + int roundInterval = 5; + + ArrayList ipsListDhbtree = new ArrayList(); + ArrayList ipsListDhvbtree = new ArrayList(); + ArrayList ipsListRtree = new ArrayList(); + ArrayList ipsListShbtree = new ArrayList(); + ArrayList ipsListSif = new ArrayList(); + sie2Dhbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListDhbtree); + sie2Dhvbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListDhvbtree); + sie2Rtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListRtree); + sie2Shbtree.getAllNodesAccumulatedInsertPS(targetRound, ipsListShbtree); + sie2Sif.getAllNodesAccumulatedInsertPS(targetRound, ipsListSif); + + sb.setLength(0); + sb.append("# sie2 accumulated inserts per second report\n"); + sb.append("# time, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + + for (int i = 0; i < targetRound; i++) { + sb.append("" + (i * roundInterval) + "," + ipsListDhbtree.get(i) + "," + ipsListDhvbtree.get(i) + "," + + ipsListRtree.get(i) + "," + ipsListShbtree.get(i) + "," + ipsListSif.get(i) + "\n"); + } + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_accumulated_insert_ps.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + ipsListDhbtree.clear(); + ipsListDhvbtree.clear(); + ipsListRtree.clear(); + ipsListShbtree.clear(); + ipsListSif.clear(); + } + + public void generateQueryPS() throws Exception { + int minutes = 60; + sb.setLength(0); + sb.append("# sie2 queries per second report\n"); + sb.append("index type, QueryPS\n"); + sb.append("dhbtree,").append(sie2Dhbtree.getQueryPS(minutes)).append("\n"); + sb.append("dhvbtree,").append(sie2Dhvbtree.getQueryPS(minutes)).append("\n"); + sb.append("rtree,").append(sie2Rtree.getQueryPS(minutes)).append("\n"); + sb.append("shbtree,").append(sie2Shbtree.getQueryPS(minutes)).append("\n"); + sb.append("sif,").append(sie2Sif.getQueryPS(minutes)).append("\n"); + + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_query_ps.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + public void generateAverageQueryResultCount() throws Exception { + sb.setLength(0); + sb.append("# sie2 average query result count report\n"); + sb.append("index type, query result count\n"); + sb.append("dhbtree,").append(sie2Dhbtree.getAverageQueryResultCount()).append("\n"); + sb.append("dhvbtree,").append(sie2Dhvbtree.getAverageQueryResultCount()).append("\n"); + sb.append("rtree,").append(sie2Rtree.getAverageQueryResultCount()).append("\n"); + sb.append("shbtree,").append(sie2Shbtree.getAverageQueryResultCount()).append("\n"); + sb.append("sif,").append(sie2Sif.getAverageQueryResultCount()).append("\n"); + + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_average_query_result_count.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + public void generateAverageQueryResponseTime() throws Exception { + sb.setLength(0); + sb.append("# sie2 average query response time report\n"); + sb.append("index type, query response time\n"); + sb.append("dhbtree,").append(sie2Dhbtree.getAverageQueryResponseTime()).append("\n"); + sb.append("dhvbtree,").append(sie2Dhvbtree.getAverageQueryResponseTime()).append("\n"); + sb.append("rtree,").append(sie2Rtree.getAverageQueryResponseTime()).append("\n"); + sb.append("shbtree,").append(sie2Shbtree.getAverageQueryResponseTime()).append("\n"); + sb.append("sif,").append(sie2Sif.getAverageQueryResponseTime()).append("\n"); + + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_average_query_response_time.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + public void generateInstantaneousInsertPS() throws Exception { + for (int i = 0; i < 8; i++) { + sb.setLength(0); + sb.append("# sie2 instantaneous inserts per second report\n"); + sb.append(sie2Dhbtree.getInstantaneousInsertPS(i, false)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_instantaneous_insert_ps_dhbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 8; i++) { + sb.setLength(0); + sb.append("# sie2 instantaneous inserts per second report\n"); + sb.append(sie2Dhvbtree.getInstantaneousInsertPS(i, false)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_instantaneous_insert_ps_dhvbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 8; i++) { + sb.setLength(0); + sb.append("# sie2 instantaneous inserts per second report\n"); + sb.append(sie2Rtree.getInstantaneousInsertPS(i, false)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_instantaneous_insert_ps_rtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 8; i++) { + sb.setLength(0); + sb.append("# sie2 instantaneous inserts per second report\n"); + sb.append(sie2Shbtree.getInstantaneousInsertPS(i, false)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_instantaneous_insert_ps_shbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 8; i++) { + sb.setLength(0); + sb.append("# sie2 instantaneous inserts per second report\n"); + sb.append(sie2Sif.getInstantaneousInsertPS(i, false)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_instantaneous_insert_ps_sif_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + } + + public void generateGanttInstantaneousInsertPS() throws Exception { + for (int i = 0; i < 1; i++) { + sb.setLength(0); + sb.append("# sie2 8nodes(8 dataGen) instantaneous inserts per second report\n"); + sb.append(sie2Dhbtree.getInstantaneousInsertPS(i, true)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_instantaneous_insert_ps_dhbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 1; i++) { + sb.setLength(0); + sb.append("# sie2 8nodes(8 dataGen) instantaneous inserts per second report\n"); + sb.append(sie2Dhvbtree.getInstantaneousInsertPS(i, true)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_instantaneous_insert_ps_dhvbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 1; i++) { + sb.setLength(0); + sb.append("# sie2 8nodes(8 dataGen) instantaneous inserts per second report\n"); + sb.append(sie2Rtree.getInstantaneousInsertPS(i, true)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_instantaneous_insert_ps_rtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 1; i++) { + sb.setLength(0); + sb.append("# sie2 8nodes(8 dataGen) instantaneous inserts per second report\n"); + sb.append(sie2Shbtree.getInstantaneousInsertPS(i, true)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_instantaneous_insert_ps_shbtree_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + for (int i = 0; i < 1; i++) { + sb.setLength(0); + sb.append("# sie2 8nodes(8 dataGen) instantaneous inserts per second report\n"); + sb.append(sie2Sif.getInstantaneousInsertPS(i, true)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_instantaneous_insert_ps_sif_gen" + i + ".txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + long dataGenStartTime = sie2Dhbtree.getDataGenStartTimeStamp(); + NCLogReportBuilder ncLogReportBuilder = new NCLogReportBuilder(expHomePath + + "SpatialIndexExperiment2Dhbtree/logs/a1_node1.log"); + sb.setLength(0); + sb.append(ncLogReportBuilder.getFlushMergeEventAsGanttChartFormat(dataGenStartTime)); + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_gantt_1node_flush_merge_dhbtree.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + dataGenStartTime = sie2Dhvbtree.getDataGenStartTimeStamp(); + ncLogReportBuilder = new NCLogReportBuilder(expHomePath + "SpatialIndexExperiment2Dhvbtree/logs/a1_node1.log"); + sb.setLength(0); + sb.append(ncLogReportBuilder.getFlushMergeEventAsGanttChartFormat(dataGenStartTime)); + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_gantt_1node_flush_merge_dhvbtree.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + dataGenStartTime = sie2Rtree.getDataGenStartTimeStamp(); + ncLogReportBuilder = new NCLogReportBuilder(expHomePath + "SpatialIndexExperiment2Rtree/logs/a1_node1.log"); + sb.setLength(0); + sb.append(ncLogReportBuilder.getFlushMergeEventAsGanttChartFormat(dataGenStartTime)); + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_gantt_1node_flush_merge_rtree.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + dataGenStartTime = sie2Shbtree.getDataGenStartTimeStamp(); + ncLogReportBuilder = new NCLogReportBuilder(expHomePath + "SpatialIndexExperiment2Shbtree/logs/a1_node1.log"); + sb.setLength(0); + sb.append(ncLogReportBuilder.getFlushMergeEventAsGanttChartFormat(dataGenStartTime)); + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_gantt_1node_flush_merge_shbtree.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + dataGenStartTime = sie2Sif.getDataGenStartTimeStamp(); + ncLogReportBuilder = new NCLogReportBuilder(expHomePath + "SpatialIndexExperiment2Sif/logs/a1_node1.log"); + sb.setLength(0); + sb.append(ncLogReportBuilder.getFlushMergeEventAsGanttChartFormat(dataGenStartTime)); + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_gantt_1node_flush_merge_sif.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + public void generateSelectQueryResponseTime() throws Exception { + sb.setLength(0); + sb.append("# sie2 select query response time report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.00001,").append(sie2Dhbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(0)).append("\n"); + sb.append("0.0001,").append(sie2Dhbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(1)).append("\n"); + sb.append("0.001,").append(sie2Dhbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(2)).append("\n"); + sb.append("0.01,").append(sie2Dhbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(3)).append("\n"); + sb.append("0.1,").append(sie2Dhbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(4)).append("\n"); + + FileOutputStream fos = ReportBuilderHelper.openOutputFile(outputFilePath + + "sie2_select_query_response_time.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + sb.setLength(0); + sb.append("# sie2 select query response time report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.00001,").append(sie2Dhbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(0)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(0)).append("\n"); + sb.append("0.0001,").append(sie2Dhbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(1)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(1)).append("\n"); + sb.append("0.001,").append(sie2Dhbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(2)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(2)).append("\n"); + + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_select_query_response_time1.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + sb.setLength(0); + sb.append("# sie2 select query response time 2 report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.01,").append(sie2Dhbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(3)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(3)).append("\n"); + sb.append("0.1,").append(sie2Dhbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Dhvbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Rtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Shbtree.getSelectQueryResponseTime(4)).append(",") + .append(sie2Sif.getSelectQueryResponseTime(4)).append("\n"); + + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_select_query_response_time2.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } + + public void generateSelectQueryResultCount() throws Exception { + + sb.setLength(0); + sb.append("# sie2 select query result count report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.00001,").append(sie2Dhbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Sif.getSelectQueryResultCount(0)).append("\n"); + sb.append("0.0001,").append(sie2Dhbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Sif.getSelectQueryResultCount(1)).append("\n"); + sb.append("0.001,").append(sie2Dhbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Sif.getSelectQueryResultCount(2)).append("\n"); + sb.append("0.01,").append(sie2Dhbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Sif.getSelectQueryResultCount(3)).append("\n"); + sb.append("0.1,").append(sie2Dhbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Sif.getSelectQueryResultCount(4)).append("\n"); + + FileOutputStream fos = ReportBuilderHelper + .openOutputFile(outputFilePath + "sie2_select_query_result_count.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + sb.setLength(0); + sb.append("# sie2 select query result count 1 report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.00001,").append(sie2Dhbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(0)).append(",") + .append(sie2Sif.getSelectQueryResultCount(0)).append("\n"); + sb.append("0.0001,").append(sie2Dhbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(1)).append(",") + .append(sie2Sif.getSelectQueryResultCount(1)).append("\n"); + sb.append("0.001,").append(sie2Dhbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(2)).append(",") + .append(sie2Sif.getSelectQueryResultCount(2)).append("\n"); + + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_select_query_result_count1.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + + sb.setLength(0); + sb.append("# sie2 select query result count 2 report\n"); + + sb.append("radius, dhbtree, dhvbtree, rtree, shbtree, sif\n"); + sb.append("0.01,").append(sie2Dhbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(3)).append(",") + .append(sie2Sif.getSelectQueryResultCount(3)).append("\n"); + sb.append("0.1,").append(sie2Dhbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Dhvbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Rtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Shbtree.getSelectQueryResultCount(4)).append(",") + .append(sie2Sif.getSelectQueryResultCount(4)).append("\n"); + + fos = ReportBuilderHelper.openOutputFile(outputFilePath + "sie2_select_query_result_count2.txt"); + fos.write(sb.toString().getBytes()); + ReportBuilderHelper.closeOutputFile(fos); + } +} http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a70fba5c/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ProfileReportBuilder.java ---------------------------------------------------------------------- diff --git a/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ProfileReportBuilder.java b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ProfileReportBuilder.java new file mode 100644 index 0000000..138afb4 --- /dev/null +++ b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ProfileReportBuilder.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.asterix.experiment.report; + +public class SIE3ProfileReportBuilder extends AbstractDynamicDataEvalReportBuilder { + public SIE3ProfileReportBuilder(String expHomePath, String expName, String runLogFileName) { + super(expHomePath, expName, runLogFileName, false); + } + + @Override + public String getOverallInsertPS(int minutes) throws Exception { + renewStringBuilder(); + openRunLog(); + try { + if (!moveToExperimentBegin()) { + //The experiment run log doesn't exist in this run log file + return null; + } + + String line; + while ((line = br.readLine()) != null) { + if (line.contains("int64")) { + line = br.readLine(); + rsb.append(Long.parseLong(line) / (minutes * 60)); + break; + } + } + + return rsb.toString(); + } finally { + closeRunLog(); + } + } + + @Override + public String getInstantaneousQueryPS() throws Exception { + return null; + } + + @Override + public String getQueryPS(int minutes) throws Exception { + return null; + // renewStringBuilder(); + // openRunLog(); + // try { + // + // return getResult(); + // } finally { + // closeRunLog(); + // } + } +} http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a70fba5c/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ReportBuilder.java ---------------------------------------------------------------------- diff --git a/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ReportBuilder.java b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ReportBuilder.java new file mode 100644 index 0000000..0f36b2a --- /dev/null +++ b/asterix-experiments/src/main/java/org/apache/asterix/experiment/report/SIE3ReportBuilder.java @@ -0,0 +1,294 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.asterix.experiment.report; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class SIE3ReportBuilder extends AbstractDynamicDataEvalReportBuilder { + private static final int WARM_UP_QUERY_COUNT = 500; + private static final int SELECT_QUERY_COUNT = 5000; //5000 + private static final int JOIN_QUERY_COUNT = 1000; + private static final int SELECT_QUERY_RADIUS_COUNT = 5; //0.00001, 0.0001, 0.001, 0.01, 0.1 + private static final int JOIN_QUERY_RADIUS_COUNT = 4; ////0.00001, 0.0001, 0.001, 0.01 + private static final String LOADED_RECORD_COUNT = "1600000000"; //1600000000 + private final String queryLogFilePath; + private BufferedReader queryLogFileBr; + + public SIE3ReportBuilder(String expHomePath, String expName, String runLogFileName, String queryLogFileName) { + super(expHomePath, expName, runLogFileName, false); + queryLogFilePath = new String(expHomePath + File.separator + expName + File.separator + queryLogFileName); + } + + private void openQueryLog() throws IOException { + queryLogFileBr = new BufferedReader(new FileReader(queryLogFilePath)); + } + + private void closeQueryLog() throws IOException { + if (queryLogFileBr != null) { + queryLogFileBr.close(); + queryLogFileBr = null; + } + } + + @Override + public String getOverallInsertPS(int minutes) throws Exception { + return null; + } + + public String get20minInsertPS(int minutes) throws Exception { + return null; + } + + @Override + public String getInstantaneousQueryPS() throws Exception { + return null; + } + + @Override + public String getQueryPS(int minutes) throws Exception { + return null; + } + + public String getIndexCreationTime() throws Exception { + renewStringBuilder(); + openQueryLog(); + + try { + String line; + long indexCreationTime = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains("There is no index with this name")) { + indexCreationTime += ReportBuilderHelper.getLong(line, "=", "for"); + break; + } + } + rsb.append((double) indexCreationTime / (1000 * 60)); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getSelectQueryResponseTime(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + String line; + long queryResponseTime = 0; + int selectQueryCount = 0; + int targetRadiusSelectQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains(LOADED_RECORD_COUNT)) { + //select queries start after total count query + // read and discard WARM_UP_QUERY_COUNT queries' results + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("Elapsed time =")) { + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT) { + break; + } + } + + // read and calculate the average query response time for the requested(target) radius + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("Elapsed time =")) { + if (selectQueryCount % SELECT_QUERY_RADIUS_COUNT == radiusIdx) { + queryResponseTime += ReportBuilderHelper.getLong(line, "=", "for"); + ++targetRadiusSelectQueryCount; + } + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT) { + break; + } + } + break; + } + } + rsb.append((double) queryResponseTime / targetRadiusSelectQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getSelectQueryResultCount(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + + String line; + long queryResultCount = 0; + int selectQueryCount = 0; + int targetRadiusSelectQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains(LOADED_RECORD_COUNT)) { + //select queries start after total count query + // read and discard WARM_UP_QUERY_COUNT queries' results + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("int64")) { + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT) { + break; + } + } + + // read and calculate the average query response time for the requested(target) radius + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("int64")) { + if (selectQueryCount % SELECT_QUERY_RADIUS_COUNT == radiusIdx) { + line = queryLogFileBr.readLine(); + queryResultCount += Long.parseLong(line); + ++targetRadiusSelectQueryCount; + } + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT) { + break; + } + } + break; + } + } + rsb.append((double) queryResultCount / targetRadiusSelectQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getJoinQueryResponseTime(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + + String line; + long queryResponseTime = 0; + int selectQueryCount = 0; + int targetRadiusJoinQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains(LOADED_RECORD_COUNT)) { + //select queries start after total count query + // read and discard WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT queries' results + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("Elapsed time =")) { + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT) { + break; + } + } + + selectQueryCount = 0; + // read and calculate the average query response time for the requested(target) radius + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("Elapsed time =")) { + if (selectQueryCount % JOIN_QUERY_RADIUS_COUNT == radiusIdx) { + if (ReportBuilderHelper.getLong(line, "=", "for") > 5000) { + System.out.println("Time: " + expName + "[" + radiusIdx + ", " + + targetRadiusJoinQueryCount + ", " + selectQueryCount + "]:" + + ReportBuilderHelper.getLong(line, "=", "for")); + } + queryResponseTime += ReportBuilderHelper.getLong(line, "=", "for"); + ++targetRadiusJoinQueryCount; + } + ++selectQueryCount; + } + if (selectQueryCount == JOIN_QUERY_COUNT) { + break; + } + } + break; + } + } + rsb.append((double) queryResponseTime / targetRadiusJoinQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } + + public String getJoinQueryResultCount(int radiusIdx) throws Exception { + renewStringBuilder(); + openQueryLog(); + try { + + String line; + long queryResultCount = 0; + int selectQueryCount = 0; + int targetRadiusJoinQueryCount = 0; + while ((line = queryLogFileBr.readLine()) != null) { + if (line.contains(LOADED_RECORD_COUNT)) { + //select queries start after total count query + // read and discard WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT queries' results + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("int64")) { + ++selectQueryCount; + } + if (selectQueryCount == WARM_UP_QUERY_COUNT + SELECT_QUERY_COUNT) { + break; + } + } + + selectQueryCount = 0; + // read and calculate the average query response time for the requested(target) radius + while (true) { + line = queryLogFileBr.readLine(); + if (line.contains("int64")) { + if (selectQueryCount % JOIN_QUERY_RADIUS_COUNT == radiusIdx) { + line = queryLogFileBr.readLine(); + + if (selectQueryCount == 600 || selectQueryCount == 824 || Long.parseLong(line) > 100000) { + System.out.println("Count: " + expName + "[" + radiusIdx + ", " + + targetRadiusJoinQueryCount + ", " + selectQueryCount + "]:" + + Long.parseLong(line)); + } + + queryResultCount += Long.parseLong(line); + ++targetRadiusJoinQueryCount; + } + ++selectQueryCount; + } + if (selectQueryCount == JOIN_QUERY_COUNT) { + break; + } + } + break; + } + } + rsb.append((double) queryResultCount / targetRadiusJoinQueryCount); + return rsb.toString(); + } finally { + closeQueryLog(); + } + } +}