Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
fb16ec9a
提交
fb16ec9a
authored
6月 21, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
integrate benchmark
上级
dce45113
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
34 行增加
和
21 行删除
+34
-21
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
BenchB.java
h2/src/test/org/h2/test/bench/BenchB.java
+1
-1
BenchC.java
h2/src/test/org/h2/test/bench/BenchC.java
+6
-6
Database.java
h2/src/test/org/h2/test/bench/Database.java
+15
-5
TestPerformance.java
h2/src/test/org/h2/test/bench/TestPerformance.java
+9
-8
Build.java
h2/src/tools/org/h2/build/Build.java
+1
-1
没有找到文件。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
fb16ec9a
...
@@ -10,6 +10,7 @@ import java.sql.SQLException;
...
@@ -10,6 +10,7 @@ import java.sql.SQLException;
import
java.util.Properties
;
import
java.util.Properties
;
import
org.h2.store.fs.FileSystemDisk
;
import
org.h2.store.fs.FileSystemDisk
;
import
org.h2.test.bench.TestPerformance
;
import
org.h2.test.db.TestAutoRecompile
;
import
org.h2.test.db.TestAutoRecompile
;
import
org.h2.test.db.TestBackup
;
import
org.h2.test.db.TestBackup
;
import
org.h2.test.db.TestBigDb
;
import
org.h2.test.db.TestBigDb
;
...
@@ -376,6 +377,7 @@ Roadmap:
...
@@ -376,6 +377,7 @@ Roadmap:
}
else
{
}
else
{
test
.
runTests
();
test
.
runTests
();
}
}
TestPerformance
.
main
(
new
String
[]{
"-init"
,
"-db"
,
"1"
});
System
.
out
.
println
(
"done ("
+
(
System
.
currentTimeMillis
()
-
time
)
+
" ms)"
);
System
.
out
.
println
(
"done ("
+
(
System
.
currentTimeMillis
()
-
time
)
+
" ms)"
);
}
}
...
...
h2/src/test/org/h2/test/bench/BenchB.java
浏览文件 @
fb16ec9a
...
@@ -47,7 +47,7 @@ public class BenchB implements Bench, Runnable {
...
@@ -47,7 +47,7 @@ public class BenchB implements Bench, Runnable {
private
BenchB
(
BenchB
master
,
int
seed
)
throws
Exception
{
private
BenchB
(
BenchB
master
,
int
seed
)
throws
Exception
{
this
.
master
=
master
;
this
.
master
=
master
;
random
=
new
Random
(
seed
);
random
=
new
Random
(
seed
);
conn
=
master
.
db
.
get
Connection
();
conn
=
master
.
db
.
openNew
Connection
();
conn
.
setAutoCommit
(
false
);
conn
.
setAutoCommit
(
false
);
updateAccount
=
conn
.
prepareStatement
(
updateAccount
=
conn
.
prepareStatement
(
"UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?"
);
"UPDATE ACCOUNTS SET ABALANCE=ABALANCE+? WHERE AID=?"
);
...
...
h2/src/test/org/h2/test/bench/BenchC.java
浏览文件 @
fb16ec9a
...
@@ -140,7 +140,7 @@ public class BenchC implements Bench {
...
@@ -140,7 +140,7 @@ public class BenchC implements Bench {
loadCustomer
();
loadCustomer
();
loadOrder
();
loadOrder
();
db
.
commit
();
db
.
commit
();
trace
(
"
l
oad done"
);
trace
(
"
L
oad done"
);
}
}
private
void
trace
(
String
s
)
{
private
void
trace
(
String
s
)
{
...
@@ -152,7 +152,7 @@ public class BenchC implements Bench {
...
@@ -152,7 +152,7 @@ public class BenchC implements Bench {
}
}
private
void
loadItem
()
throws
Exception
{
private
void
loadItem
()
throws
Exception
{
trace
(
"
load item
"
);
trace
(
"
Loading item table
"
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO ITEM(I_ID, I_IM_ID, I_NAME, I_PRICE, I_DATA) "
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO ITEM(I_ID, I_IM_ID, I_NAME, I_PRICE, I_DATA) "
+
"VALUES(?, ?, ?, ?, ?)"
);
+
"VALUES(?, ?, ?, ?, ?)"
);
...
@@ -177,7 +177,7 @@ public class BenchC implements Bench {
...
@@ -177,7 +177,7 @@ public class BenchC implements Bench {
}
}
private
void
loadWarehouse
()
throws
Exception
{
private
void
loadWarehouse
()
throws
Exception
{
trace
(
"
loading warehouses
"
);
trace
(
"
Loading warehouse table
"
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO WAREHOUSE(W_ID, W_NAME, W_STREET_1, "
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO WAREHOUSE(W_ID, W_NAME, W_STREET_1, "
+
"W_STREET_2, W_CITY, W_STATE, W_ZIP, W_TAX, W_YTD) "
+
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
+
"W_STREET_2, W_CITY, W_STATE, W_ZIP, W_TAX, W_YTD) "
+
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
for
(
int
id
=
1
;
id
<=
warehouses
;
id
++)
{
for
(
int
id
=
1
;
id
<=
warehouses
;
id
++)
{
...
@@ -209,7 +209,7 @@ public class BenchC implements Bench {
...
@@ -209,7 +209,7 @@ public class BenchC implements Bench {
}
}
private
void
loadCustomer
()
throws
Exception
{
private
void
loadCustomer
()
throws
Exception
{
trace
(
"
load customers
"
);
trace
(
"
Load customer table
"
);
int
max
=
warehouses
*
districtsPerWarehouse
;
int
max
=
warehouses
*
districtsPerWarehouse
;
int
i
=
0
;
int
i
=
0
;
for
(
int
id
=
1
;
id
<=
warehouses
;
id
++)
{
for
(
int
id
=
1
;
id
<=
warehouses
;
id
++)
{
...
@@ -298,7 +298,7 @@ public class BenchC implements Bench {
...
@@ -298,7 +298,7 @@ public class BenchC implements Bench {
}
}
private
void
loadOrder
()
throws
Exception
{
private
void
loadOrder
()
throws
Exception
{
trace
(
"
load orders
"
);
trace
(
"
Loading order table
"
);
int
max
=
warehouses
*
districtsPerWarehouse
;
int
max
=
warehouses
*
districtsPerWarehouse
;
int
i
=
0
;
int
i
=
0
;
for
(
int
wId
=
1
;
wId
<=
warehouses
;
wId
++)
{
for
(
int
wId
=
1
;
wId
<=
warehouses
;
wId
++)
{
...
@@ -369,7 +369,7 @@ public class BenchC implements Bench {
...
@@ -369,7 +369,7 @@ public class BenchC implements Bench {
}
}
private
void
loadStock
(
int
wId
)
throws
Exception
{
private
void
loadStock
(
int
wId
)
throws
Exception
{
trace
(
"
load stock
(warehouse "
+
wId
+
")"
);
trace
(
"
Loading stock table
(warehouse "
+
wId
+
")"
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
boolean
[]
original
=
random
.
getBoolean
(
items
,
items
/
10
);
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO STOCK(S_I_ID, S_W_ID, S_QUANTITY, "
PreparedStatement
prep
=
db
.
prepare
(
"INSERT INTO STOCK(S_I_ID, S_W_ID, S_QUANTITY, "
+
"S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05, "
+
"S_DIST_01, S_DIST_02, S_DIST_03, S_DIST_04, S_DIST_05, "
...
...
h2/src/test/org/h2/test/bench/Database.java
浏览文件 @
fb16ec9a
...
@@ -160,7 +160,6 @@ class Database {
...
@@ -160,7 +160,6 @@ class Database {
if
(
tokenizer
.
hasMoreTokens
())
{
if
(
tokenizer
.
hasMoreTokens
())
{
db
.
password
=
tokenizer
.
nextToken
().
trim
();
db
.
password
=
tokenizer
.
nextToken
().
trim
();
}
}
System
.
out
.
println
(
"Loaded successfully: "
+
db
.
name
);
return
db
;
return
db
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Cannot load database "
+
dbString
+
" :"
+
e
.
toString
());
System
.
out
.
println
(
"Cannot load database "
+
dbString
+
" :"
+
e
.
toString
());
...
@@ -178,10 +177,13 @@ class Database {
...
@@ -178,10 +177,13 @@ class Database {
}
}
/**
/**
* Open a database connection.
* Open a new database connection. This connection must be closed
* by calling conn.close().
*
* @return the opened connection
*/
*/
void
open
Connection
()
throws
SQLException
{
Connection
openNew
Connection
()
throws
SQLException
{
conn
=
DriverManager
.
getConnection
(
url
,
user
,
password
);
Connection
conn
=
DriverManager
.
getConnection
(
url
,
user
,
password
);
if
(
url
.
startsWith
(
"jdbc:derby:"
))
{
if
(
url
.
startsWith
(
"jdbc:derby:"
))
{
// Derby: use higher cache size
// Derby: use higher cache size
Statement
stat
=
null
;
Statement
stat
=
null
;
...
@@ -206,6 +208,14 @@ class Database {
...
@@ -206,6 +208,14 @@ class Database {
JdbcUtils
.
closeSilently
(
stat
);
JdbcUtils
.
closeSilently
(
stat
);
}
}
}
}
return
conn
;
}
/**
* Open the database connection.
*/
void
openConnection
()
throws
SQLException
{
conn
=
openNewConnection
();
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
}
}
...
...
h2/src/test/org/h2/test/bench/TestPerformance.java
浏览文件 @
fb16ec9a
...
@@ -205,8 +205,7 @@ public class TestPerformance {
...
@@ -205,8 +205,7 @@ public class TestPerformance {
// }
// }
// writer.println("</table>");
// writer.println("</table>");
System
.
out
.
println
(
"Test finished"
);
// System.exit(0);
System
.
exit
(
0
);
}
}
private
void
testAll
(
ArrayList
dbs
,
ArrayList
tests
,
int
size
)
throws
Exception
{
private
void
testAll
(
ArrayList
dbs
,
ArrayList
tests
,
int
size
)
throws
Exception
{
...
@@ -217,17 +216,19 @@ public class TestPerformance {
...
@@ -217,17 +216,19 @@ public class TestPerformance {
// calls garbage collection
// calls garbage collection
TestBase
.
getMemoryUsed
();
TestBase
.
getMemoryUsed
();
Database
db
=
(
Database
)
dbs
.
get
(
i
);
Database
db
=
(
Database
)
dbs
.
get
(
i
);
System
.
out
.
println
(
"
testing
"
+
db
.
getName
());
System
.
out
.
println
(
"
Testing performance of
"
+
db
.
getName
());
db
.
startServer
();
db
.
startServer
();
Connection
conn
=
db
.
get
Connection
();
Connection
conn
=
db
.
openNew
Connection
();
runDatabase
(
db
,
tests
,
1
);
runDatabase
(
db
,
tests
,
1
);
runDatabase
(
db
,
tests
,
1
);
runDatabase
(
db
,
tests
,
1
);
collect
=
true
;
collect
=
true
;
runDatabase
(
db
,
tests
,
size
);
runDatabase
(
db
,
tests
,
size
);
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
());
db
.
log
(
"Statement per Second"
,
"#"
,
db
.
getExecutedStatements
()
*
1000
/
db
.
getTotalTime
());
int
statPerSec
=
db
.
getExecutedStatements
()
*
1000
/
db
.
getTotalTime
();
db
.
log
(
"Statements per second"
,
"#"
,
statPerSec
);
System
.
out
.
println
(
"Statements per second: "
+
statPerSec
);
collect
=
false
;
collect
=
false
;
db
.
stopServer
();
db
.
stopServer
();
}
}
...
...
h2/src/tools/org/h2/build/Build.java
浏览文件 @
fb16ec9a
...
@@ -55,7 +55,7 @@ public class Build extends BuildBase {
...
@@ -55,7 +55,7 @@ public class Build extends BuildBase {
download
(
"ext/mysql-connector-java-5.1.6.jar"
,
download
(
"ext/mysql-connector-java-5.1.6.jar"
,
"http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar"
,
"http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar"
,
"380ef5226de2c85ff3b38cbfefeea881c5fce09d"
);
"380ef5226de2c85ff3b38cbfefeea881c5fce09d"
);
String
cp
=
"
bin
"
+
File
.
pathSeparator
+
"bin/h2.jar"
+
File
.
pathSeparator
+
String
cp
=
"
temp
"
+
File
.
pathSeparator
+
"bin/h2.jar"
+
File
.
pathSeparator
+
"ext/hsqldb-1.8.0.7.jar"
+
File
.
pathSeparator
+
"ext/hsqldb-1.8.0.7.jar"
+
File
.
pathSeparator
+
"ext/derby-10.4.1.3.jar"
+
File
.
pathSeparator
+
"ext/derby-10.4.1.3.jar"
+
File
.
pathSeparator
+
"ext/derbyclient-10.4.1.3.jar"
+
File
.
pathSeparator
+
"ext/derbyclient-10.4.1.3.jar"
+
File
.
pathSeparator
+
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论