提交 cf0726c6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Support benchmarks with larger databases

上级 d3c47d30
...@@ -192,7 +192,7 @@ public class BenchCThread { ...@@ -192,7 +192,7 @@ public class BenchCThread {
dist[i] = rs.getString(3 + i); dist[i] = rs.getString(3 + i);
} }
rs.close(); rs.close();
String distInfo = dist[dId - 1]; String distInfo = dist[(dId - 1) % 10];
stock[number - 1] = sQuantity; stock[number - 1] = sQuantity;
if ((data.indexOf("original") != -1) if ((data.indexOf("original") != -1)
&& (sData.indexOf("original") != -1)) { && (sData.indexOf("original") != -1)) {
......
...@@ -71,6 +71,11 @@ public class TestPerformance implements Database.DatabaseTest { ...@@ -71,6 +71,11 @@ public class TestPerformance implements Database.DatabaseTest {
int dbId = -1; int dbId = -1;
boolean exit = false; boolean exit = false;
String out = "benchmark.html"; String out = "benchmark.html";
Properties prop = new Properties();
InputStream in = getClass().getResourceAsStream("test.properties");
prop.load(in);
in.close();
int size = Integer.parseInt(prop.getProperty("size"));
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
String arg = args[i]; String arg = args[i];
if ("-db".equals(arg)) { if ("-db".equals(arg)) {
...@@ -83,13 +88,10 @@ public class TestPerformance implements Database.DatabaseTest { ...@@ -83,13 +88,10 @@ public class TestPerformance implements Database.DatabaseTest {
trace = true; trace = true;
} else if ("-exit".equals(arg)) { } else if ("-exit".equals(arg)) {
exit = true; exit = true;
} else if ("-size".equals(arg)) {
size = Integer.parseInt(args[++i]);
} }
} }
Properties prop = new Properties();
InputStream in = getClass().getResourceAsStream("test.properties");
prop.load(in);
in.close();
int size = Integer.parseInt(prop.getProperty("size"));
ArrayList<Database> dbs = new ArrayList<Database>(); ArrayList<Database> dbs = new ArrayList<Database>();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
if (dbId != -1 && i != dbId) { if (dbId != -1 && i != dbId) {
...@@ -230,7 +232,7 @@ public class TestPerformance implements Database.DatabaseTest { ...@@ -230,7 +232,7 @@ public class TestPerformance implements Database.DatabaseTest {
conn.close(); conn.close();
db.log("Executed statements", "#", db.getExecutedStatements()); db.log("Executed statements", "#", db.getExecutedStatements());
db.log("Total time", "ms", db.getTotalTime()); db.log("Total time", "ms", db.getTotalTime());
int statPerSec = db.getExecutedStatements() * 1000 / db.getTotalTime(); int statPerSec = (int) (db.getExecutedStatements() * 1000L / db.getTotalTime());
db.log("Statements per second", "#", statPerSec); db.log("Statements per second", "#", statPerSec);
System.out.println("Statements per second: " + statPerSec); System.out.println("Statements per second: " + statPerSec);
collect = false; collect = false;
......
...@@ -171,7 +171,7 @@ public class TestScalability implements Database.DatabaseTest { ...@@ -171,7 +171,7 @@ public class TestScalability implements Database.DatabaseTest {
conn.close(); conn.close();
db.log("Executed statements", "#", db.getExecutedStatements()); db.log("Executed statements", "#", db.getExecutedStatements());
db.log("Total time", "ms", db.getTotalTime()); db.log("Total time", "ms", db.getTotalTime());
int statPerSec = db.getExecutedStatements() * 1000 / db.getTotalTime(); int statPerSec = (int) (db.getExecutedStatements() * 1000L / db.getTotalTime());
db.log("Statements per second", "#", statPerSec); db.log("Statements per second", "#", statPerSec);
System.out.println("Statements per second: " + statPerSec); System.out.println("Statements per second: " + statPerSec);
collect = false; collect = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论