本文整理汇总了Java中org.hsqldb.lib.StopWatch类的典型用法代码示例。如果您正苦于以下问题:Java StopWatch类的具体用法?Java StopWatch怎么用?Java StopWatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StopWatch类属于org.hsqldb.lib包,在下文中一共展示了StopWatch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: countTestZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void countTestZip() {
try {
StopWatch sw = new StopWatch();
sStatement.execute("SELECT count(*) from TEST where zip > -1");
ResultSet rs = sStatement.getResultSet();
rs.next();
long time = (long) sw.elapsedTime();
long rate = ((long) bigrows * 1000) / (time + 1);
storeResult("count (index on zip)", rs.getInt(1), time, rate);
System.out.println("count time (index on zip) " + rs.getInt(1)
+ " rows -- " + time + " ms -- " + rate
+ " tps");
} catch (SQLException e) {}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:21,代码来源:TestCacheSize.java
示例2: countTestID
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void countTestID() {
try {
StopWatch sw = new StopWatch();
// the tests use different indexes
// use primary index
sStatement.execute("SELECT count(*) from TEST where id > -1");
ResultSet rs = sStatement.getResultSet();
rs.next();
long time = sw.elapsedTime();
long rate = ((long) bigrows * 1000) / (time + 1);
storeResult("count (index on id)", rs.getInt(1), time, rate);
System.out.println("count time (index on id) " + rs.getInt(1)
+ " rows -- " + time + " ms -- " + rate
+ " tps");
} catch (SQLException e) {}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:TestCacheSize.java
示例3: countTestID
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void countTestID() {
try {
StopWatch sw = new StopWatch();
// the tests use different indexes
// use primary index
sStatement.execute("SELECT count(*) from TEST where id > -1");
ResultSet rs = sStatement.getResultSet();
rs.next();
int time = (int) sw.elapsedTime();
int rate = (bigrows * 1000) / (time + 1);
storeResult("count (index on id)", rs.getInt(1), time, rate);
System.out.println("count time (index on id) " + rs.getInt(1)
+ " rows -- " + time + " ms -- " + rate
+ " tps");
} catch (SQLException e) {}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:TestCacheSize.java
示例4: countTestZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void countTestZip() {
try {
StopWatch sw = new StopWatch();
sStatement.execute("SELECT count(*) from TEST where zip > -1");
ResultSet rs = sStatement.getResultSet();
rs.next();
int time = (int) sw.elapsedTime();
int rate = (bigrows * 1000) / (time + 1);
storeResult("count (index on zip)", rs.getInt(1), time, rate);
System.out.println("count time (index on zip) " + rs.getInt(1)
+ " rows -- " + time + " ms -- " + rate
+ " tps");
} catch (SQLException e) {}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:TestCacheSize.java
示例5: checkResults
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
protected void checkResults() {
try {
StopWatch sw = new StopWatch();
ResultSet rs;
cConnection = DriverManager.getConnection(url + filepath, user,
password);
long time = sw.elapsedTime();
storeResult("reopen", 0, time, 0);
System.out.println("database reopen time -- " + time + " ms");
sw.zero();
sStatement = cConnection.createStatement();
// sStatement.execute("SET WRITE_DELAY " + writeDelay);
checkSelects();
checkUpdates();
sw.zero();
if (shutdown) {
sStatement.execute("SHUTDOWN");
time = sw.elapsedTime();
storeResult("shutdown", 0, time, 0);
System.out.println("shutdown time -- " + time + " ms");
}
cConnection.close();
// System.out.println("database close time -- " + sw.elapsedTime() + " ms");
} catch (SQLException e) {
e.printStackTrace();
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:39,代码来源:TestCacheSize.java
示例6: selectZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
void selectZip() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
try {
PreparedStatement ps = cConnection.prepareStatement(
"SELECT TOP 1 firstname,lastname,zip,filler FROM test WHERE zip = ?");
for (; i < bigops; i++) {
ps.setInt(1, nextIntRandom(randomgen, smallrows));
ps.execute();
if ((i + 1) == 100 && sw.elapsedTime() > 50000) {
slow = true;
}
if (reportProgress && (i + 1) % 10000 == 0
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ sw.elapsedTime() + " rps: "
+ (i * 1000 / (sw.elapsedTime() + 1)));
}
}
} catch (SQLException e) {
e.printStackTrace();
}
long time = sw.elapsedTime();
long rate = ((long) i * 1000) / (time + 1);
storeResult("select random zip", i, time, rate);
System.out.println("select time for random zip " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:38,代码来源:TestCacheSize.java
示例7: selectID
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
void selectID() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
try {
PreparedStatement ps = cConnection.prepareStatement(
"SELECT firstname,lastname,zip,filler FROM test WHERE id = ?");
for (i = 0; i < smallops; i++) {
ps.setInt(1, nextIntRandom(randomgen, bigrows - 1));
ps.execute();
if (reportProgress && (i + 1) % 10000 == 0
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ (sw.elapsedTime() + 1));
}
}
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
long time = sw.elapsedTime();
long rate = ((long) i * 1000) / (time + 1);
storeResult("select random id", i, time, rate);
System.out.println("select time for random id " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:35,代码来源:TestCacheSize.java
示例8: selectZipTable
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
void selectZipTable() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
try {
PreparedStatement ps = cConnection.prepareStatement(
"SELECT zip FROM zip WHERE zip = ?");
for (i = 0; i < bigops; i++) {
ps.setInt(1, nextIntRandom(randomgen, smallrows - 1));
ps.execute();
if (reportProgress && (i + 1) % 10000 == 0
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ (sw.elapsedTime() + 1));
}
}
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
long time = sw.elapsedTime();
long rate = ((long) i * 1000) / (time + 1);
storeResult("select random zip (zip table)", i, time, rate);
System.out.println("select time for random zip from zip table " + i
+ " rows -- " + time + " ms -- " + rate + " tps");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:35,代码来源:TestCacheSize.java
示例9: countZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void countZip() {
try {
StopWatch sw = new StopWatch();
sStatement.execute("SELECT count(*) from zip where zip > -1");
ResultSet rs = sStatement.getResultSet();
rs.next();
System.out.println("count time (zip table) " + rs.getInt(1)
+ " rows -- " + sw.elapsedTime() + " ms");
} catch (SQLException e) {}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:15,代码来源:TestCacheSize.java
示例10: updateZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void updateZip() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
int count = 0;
int random = 0;
try {
PreparedStatement ps = cConnection.prepareStatement(
"UPDATE test SET filler = filler || zip WHERE zip = ?");
for (; i < smallrows; i++) {
random = nextIntRandom(randomgen, smallrows - 1);
ps.setInt(1, random);
count += ps.executeUpdate();
if (reportProgress && count % 10000 < 20) {
System.out.println("Update " + count + " : "
+ (sw.elapsedTime() + 1));
}
}
ps.close();
} catch (SQLException e) {
System.out.println("error : " + random);
e.printStackTrace();
}
long time = sw.elapsedTime();
long rate = (i * 1000) / (time + 1);
storeResult("update with random zip", i, time, rate);
System.out.println("update time with random zip " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:40,代码来源:TestCacheSize.java
示例11: main
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public static void main(String[] argv) {
TestCacheSize test = new TestCacheSize();
HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test");
test.bigops = props.getIntegerProperty("test.bigops", test.bigops);
test.bigrows = test.bigops;
test.smallops = test.bigops / 8;
test.cacheScale = props.getIntegerProperty("test.scale",
test.cacheScale);
test.tableType = props.getProperty("test.tabletype", test.tableType);
test.nioMode = props.isPropertyTrue("test.nio", test.nioMode);
if (props.getProperty("test.dbtype", "").equals("mem")) {
test.filepath = "mem:test";
test.filedb = false;
test.shutdown = false;
}
test.setUp();
StopWatch sw = new StopWatch();
test.testFillUp();
test.checkResults();
long time = sw.elapsedTime();
test.storeResult("total test time", 0, (int) time, 0);
System.out.println("total test time -- " + sw.elapsedTime() + " ms");
test.tearDown();
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:33,代码来源:TestCacheSize.java
示例12: testSpeed
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public void testSpeed() {
randomGenerator = new Random(System.currentTimeMillis());
int TEST_RUNS = 100000;
int LOOP_COUNT = 1000;
HsqlArrayList arrayList = new HsqlArrayList(TEST_RUNS);
ArrayList utilArrayList = new ArrayList(TEST_RUNS);
Vector vector = new Vector(TEST_RUNS);
Integer value = new Integer(randomGenerator.nextInt());
Integer INT_0 = new Integer(0);
StopWatch sw = new StopWatch();
System.out.println(sw.currentElapsedTimeToMessage("time"));
for (int i = 0; i < TEST_RUNS; i++) {
arrayList.add(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
arrayList.set(i, INT_0);
}
}
System.out.println(
sw.currentElapsedTimeToMessage("time HsqlArrayLsit"));
sw.zero();
for (int i = 0; i < TEST_RUNS; i++) {
utilArrayList.add(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
utilArrayList.set(i, INT_0);
}
}
System.out.println(sw.currentElapsedTimeToMessage("time ArrayList"));
sw.zero();
for (int i = 0; i < TEST_RUNS; i++) {
vector.addElement(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
vector.setElementAt(INT_0, i);
}
}
System.out.println(sw.currentElapsedTimeToMessage("time Vector"));
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:55,代码来源:TestDataStructures.java
示例13: TestObjectSize
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public TestObjectSize() {
StopWatch sw = new StopWatch();
int testCount = 2350000;
System.out.println("Fill Memory with Objects ");
Object[] objectArray = new Object[testCount];
for (int j = 0; j < objectArray.length; j++) {
objectArray[j] = new Timestamp(0);
}
System.out.println("Array Filled " + sw.elapsedTime());
for (int j = 0; j < objectArray.length; j++) {
objectArray[j] = null;
}
Object[] objectArray2 = new Object[testCount];
Object[] objectArray3 = new Object[testCount];
Object[] objectArray4 = new Object[testCount];
Object[] objectArray5 = new Object[testCount];
Object[] objectArray6 = new Object[testCount];
// Object[] objectArray7 = new Object[testCount];
short[] shortArray = new short[testCount];
byte[] byteArray = new byte[testCount];
System.out.println("Fill with Empty Arrays " + sw.elapsedTime());
sw.zero();
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:33,代码来源:TestObjectSize.java
示例14: main
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public static void main(String[] argv) {
TestCacheSize test = new TestCacheSize();
HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test");
test.bigops = props.getIntegerProperty("test.bigops", test.bigops);
test.bigrows = test.bigops;
test.smallops = test.bigops / 8;
test.cacheScale = props.getIntegerProperty("test.scale",
test.cacheScale);
test.logType = props.getProperty("test.logtype", test.logType);
test.tableType = props.getProperty("test.tabletype", test.tableType);
test.nioMode = props.isPropertyTrue("test.nio", test.nioMode);
if (props.getProperty("test.dbtype", "").equals("mem")) {
test.filepath = "mem:test";
test.filedb = false;
test.shutdown = false;
}
test.setUp();
StopWatch sw = new StopWatch();
test.testFillUp();
test.checkResults();
long time = sw.elapsedTime();
test.storeResult("total test time", 0, (int) time, 0);
System.out.println("total test time -- " + sw.elapsedTime() + " ms");
test.tearDown();
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:TestCacheSize.java
示例15: main
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public static void main(String[] argv) {
StopWatch sw = new StopWatch();
TestAllTypes test = new TestAllTypes();
test.setUp();
test.testFillUp();
// test.tearDown();
test.checkResults();
System.out.println("Total Test Time: " + sw.elapsedTime());
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:13,代码来源:TestAllTypes.java
示例16: testSpeed
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
public void testSpeed() {
randomGenerator = new Random(System.currentTimeMillis());
int TEST_RUNS = 100000;
int LOOP_COUNT = 1000;
HsqlArrayList arrayList = new HsqlArrayList(TEST_RUNS);
ArrayList utilArrayList = new ArrayList(TEST_RUNS);
Vector vector = new Vector(TEST_RUNS);
Integer value = new Integer(randomGenerator.nextInt());
Integer INT_0 = new Integer(0);
StopWatch sw = new StopWatch();
System.out.println(sw.currentElapsedTimeToMessage("time"));
for (int i = 0; i < TEST_RUNS; i++) {
arrayList.add(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
arrayList.set(i, INT_0);
}
}
System.out.println(sw.currentElapsedTimeToMessage("time"));
sw.zero();
for (int i = 0; i < TEST_RUNS; i++) {
utilArrayList.add(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
utilArrayList.set(i, INT_0);
}
}
System.out.println(sw.currentElapsedTimeToMessage("time"));
sw.zero();
for (int i = 0; i < TEST_RUNS; i++) {
vector.addElement(INT_0);
}
for (int i = 0; i < TEST_RUNS; i++) {
for (int j = 0; j < LOOP_COUNT; j++) {
vector.setElementAt(INT_0, i);
}
}
System.out.println(sw.currentElapsedTimeToMessage("time"));
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:54,代码来源:TestDataStructures.java
示例17: checkResults
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
protected void checkResults() {
try {
StopWatch sw = new StopWatch();
ResultSet rs;
cConnection = DriverManager.getConnection(url + filepath, user,
password);
int time = (int) sw.elapsedTime();
storeResult("reopen", 0, time, 0);
System.out.println("database reopen time -- " + time + " ms");
sw.zero();
sStatement = cConnection.createStatement();
// sStatement.execute("SET WRITE_DELAY " + writeDelay);
checkSelects();
checkUpdates();
sw.zero();
if (shutdown) {
sStatement.execute("SHUTDOWN");
time = (int) sw.elapsedTime();
storeResult("shutdown", 0, time, 0);
System.out.println("shutdown time -- " + time + " ms");
}
cConnection.close();
// System.out.println("database close time -- " + sw.elapsedTime() + " ms");
} catch (SQLException e) {
e.printStackTrace();
}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:TestCacheSize.java
示例18: selectZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
void selectZip() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
try {
PreparedStatement ps = cConnection.prepareStatement(
"SELECT TOP 1 firstname,lastname,zip,filler FROM test WHERE zip = ?");
for (; i < bigops; i++) {
ps.setInt(1, nextIntRandom(randomgen, smallrows));
ps.execute();
if ((i + 1) == 100 && sw.elapsedTime() > 50000) {
slow = true;
}
if (reportProgress && (i + 1) % 10000 == 0
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ sw.elapsedTime() + " rps: "
+ (i * 1000 / (sw.elapsedTime() + 1)));
}
}
} catch (SQLException e) {
e.printStackTrace();
}
int time = (int) sw.elapsedTime();
int rate = (i * 1000) / (time + 1);
storeResult("select random zip", i, time, rate);
System.out.println("select time for random zip " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:TestCacheSize.java
示例19: selectID
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
void selectID() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
try {
PreparedStatement ps = cConnection.prepareStatement(
"SELECT firstname,lastname,zip,filler FROM test WHERE id = ?");
for (i = 0; i < bigops; i++) {
ps.setInt(1, nextIntRandom(randomgen, bigrows - 1));
ps.execute();
if (reportProgress && (i + 1) % 10000 == 0
|| (slow && (i + 1) % 100 == 0)) {
System.out.println("Select " + (i + 1) + " : "
+ (sw.elapsedTime() + 1));
}
}
} catch (SQLException e) {
e.printStackTrace();
}
int time = (int) sw.elapsedTime();
int rate = (i * 1000) / (time + 1);
storeResult("select random id", i, time, rate);
System.out.println("select time for random id " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:33,代码来源:TestCacheSize.java
示例20: updateZip
import org.hsqldb.lib.StopWatch; //导入依赖的package包/类
private void updateZip() {
StopWatch sw = new StopWatch();
java.util.Random randomgen = new java.util.Random();
int i = 0;
boolean slow = false;
int count = 0;
int random = 0;
try {
PreparedStatement ps = cConnection.prepareStatement(
"UPDATE test SET filler = filler || zip WHERE zip = ?");
for (; i < smallrows; i++) {
random = nextIntRandom(randomgen, smallrows - 1);
ps.setInt(1, random);
count += ps.executeUpdate();
if (reportProgress && count % 10000 < 20) {
System.out.println("Update " + count + " : "
+ (sw.elapsedTime() + 1));
}
}
} catch (SQLException e) {
System.out.println("error : " + random);
e.printStackTrace();
}
int time = (int) sw.elapsedTime();
int rate = (i * 1000) / (time + 1);
storeResult("update with random zip", i, time, rate);
System.out.println("update time with random zip " + i + " rows -- "
+ time + " ms -- " + rate + " tps");
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:TestCacheSize.java
注:本文中的org.hsqldb.lib.StopWatch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论