提交 5cfd9912 authored 作者: Thomas Mueller's avatar Thomas Mueller

better trace messages

上级 5f1bd724
...@@ -34,17 +34,17 @@ public class TestMemoryUsage extends TestBase { ...@@ -34,17 +34,17 @@ public class TestMemoryUsage extends TestBase {
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("memoryUsage"); deleteDb("memoryUsage");
// testCreateDropLoop(); testCreateDropLoop();
testCreateIndex(); testCreateIndex();
// testClob(); testClob();
// deleteDb("memoryUsage"); deleteDb("memoryUsage");
// testReconnectOften(); testReconnectOften();
// deleteDb("memoryUsage"); deleteDb("memoryUsage");
// reconnect(); reconnect();
// insertUpdateSelectDelete(); insertUpdateSelectDelete();
// reconnect(); reconnect();
// insertUpdateSelectDelete(); insertUpdateSelectDelete();
// conn.close(); conn.close();
deleteDb("memoryUsage"); deleteDb("memoryUsage");
} }
...@@ -107,17 +107,14 @@ public class TestMemoryUsage extends TestBase { ...@@ -107,17 +107,14 @@ public class TestMemoryUsage extends TestBase {
} }
Connection conn = getConnection("memoryUsage"); Connection conn = getConnection("memoryUsage");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id int, name varchar)"); stat.execute("create table test(id int, name varchar(255))");
int todo;
// PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(200) || ?)");
PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(200))"); PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(200))");
int len = getSize(10000, 100000); int len = getSize(10000, 100000);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
// if(i % 1000 == 0) { if (i % 1000 == 0) {
// System.out.println(" " + i + " of " + len + " used KB: " + MemoryUtils.getMemoryUsed()); // trace("[" + i + "/" + len + "] KB: " + MemoryUtils.getMemoryUsed());
// } }
prep.setInt(1, i); prep.setInt(1, i);
// prep.setInt(2, i);
prep.executeUpdate(); prep.executeUpdate();
} }
int start = MemoryUtils.getMemoryUsed(); int start = MemoryUtils.getMemoryUsed();
......
...@@ -9,6 +9,7 @@ package org.h2.test.unit; ...@@ -9,6 +9,7 @@ package org.h2.test.unit;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.message.Trace;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.store.DataPage; import org.h2.store.DataPage;
import org.h2.store.FileStore; import org.h2.store.FileStore;
...@@ -157,4 +158,8 @@ public class TestDataPage extends TestBase implements DataHandler { ...@@ -157,4 +158,8 @@ public class TestDataPage extends TestBase implements DataHandler {
return TempFileDeleter.getInstance(); return TempFileDeleter.getInstance();
} }
public Trace getTrace() {
return null;
}
} }
...@@ -9,6 +9,7 @@ package org.h2.test.unit; ...@@ -9,6 +9,7 @@ package org.h2.test.unit;
import java.util.Random; import java.util.Random;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.message.Trace;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.store.FileStore; import org.h2.store.FileStore;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -192,4 +193,8 @@ public class TestFile extends TestBase implements DataHandler { ...@@ -192,4 +193,8 @@ public class TestFile extends TestBase implements DataHandler {
return TempFileDeleter.getInstance(); return TempFileDeleter.getInstance();
} }
public Trace getTrace() {
return null;
}
} }
...@@ -12,6 +12,7 @@ import java.util.HashMap; ...@@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.Random; import java.util.Random;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.message.Trace;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.store.FileStore; import org.h2.store.FileStore;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -157,4 +158,8 @@ public class TestValueHashMap extends TestBase implements DataHandler { ...@@ -157,4 +158,8 @@ public class TestValueHashMap extends TestBase implements DataHandler {
return TempFileDeleter.getInstance(); return TempFileDeleter.getInstance();
} }
public Trace getTrace() {
return null;
}
} }
...@@ -18,6 +18,7 @@ import java.util.Random; ...@@ -18,6 +18,7 @@ import java.util.Random;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.message.Trace;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.store.FileStore; import org.h2.store.FileStore;
import org.h2.test.TestBase; import org.h2.test.TestBase;
...@@ -247,5 +248,9 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -247,5 +248,9 @@ public class TestValueMemory extends TestBase implements DataHandler {
public TempFileDeleter getTempFileDeleter() { public TempFileDeleter getTempFileDeleter() {
return TempFileDeleter.getInstance(); return TempFileDeleter.getInstance();
} }
public Trace getTrace() {
return null;
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论