Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
e0bece00
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e0bece00
编写于
3月 24, 2014
作者:
J
jwilhelm
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
3f88af3a
a3d582df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
353 addition
and
0 deletion
+353
-0
test/TEST.groups
test/TEST.groups
+2
-0
test/gc/arguments/TestDynMaxHeapFreeRatio.java
test/gc/arguments/TestDynMaxHeapFreeRatio.java
+64
-0
test/gc/arguments/TestDynMinHeapFreeRatio.java
test/gc/arguments/TestDynMinHeapFreeRatio.java
+62
-0
test/testlibrary/com/oracle/java/testlibrary/DynamicVMOptionChecker.java
...y/com/oracle/java/testlibrary/DynamicVMOptionChecker.java
+121
-0
test/testlibrary/com/oracle/java/testlibrary/TestDynamicVMOption.java
...rary/com/oracle/java/testlibrary/TestDynamicVMOption.java
+104
-0
未找到文件。
test/TEST.groups
浏览文件 @
e0bece00
...
...
@@ -130,6 +130,8 @@ needs_compact3 = \
gc/g1/TestHumongousAllocInitialMark.java \
gc/arguments/TestG1HeapRegionSize.java \
gc/metaspace/TestMetaspaceMemoryPool.java \
gc/arguments/TestDynMinHeapFreeRatio.java \
gc/arguments/TestDynMaxHeapFreeRatio.java \
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
serviceability/threads/TestFalseDeadLock.java \
compiler/tiered/NonTieredLevelsTest.java \
...
...
test/gc/arguments/TestDynMaxHeapFreeRatio.java
0 → 100644
浏览文件 @
e0bece00
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestDynMaxHeapFreeRatio
* @bug 8028391
* @summary Verify that MaxHeapFreeRatio flag is manageable
* @library /testlibrary
* @run main TestDynMaxHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMaxHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 TestDynMaxHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=51 -XX:MaxHeapFreeRatio=52 TestDynMaxHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=75 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio
*/
import
com.oracle.java.testlibrary.TestDynamicVMOption
;
import
com.oracle.java.testlibrary.DynamicVMOptionChecker
;
public
class
TestDynMaxHeapFreeRatio
extends
TestDynamicVMOption
{
public
static
final
String
MinFreeRatioFlagName
=
"MinHeapFreeRatio"
;
public
static
final
String
MaxFreeRatioFlagName
=
"MaxHeapFreeRatio"
;
public
TestDynMaxHeapFreeRatio
()
{
super
(
MaxFreeRatioFlagName
);
}
public
void
test
()
{
int
minHeapFreeValue
=
DynamicVMOptionChecker
.
getIntValue
(
MinFreeRatioFlagName
);
System
.
out
.
println
(
MinFreeRatioFlagName
+
" = "
+
minHeapFreeValue
);
testPercentageValues
();
checkInvalidValue
(
Integer
.
toString
(
minHeapFreeValue
-
1
));
checkValidValue
(
Integer
.
toString
(
minHeapFreeValue
));
checkValidValue
(
"100"
);
}
public
static
void
main
(
String
args
[])
throws
Exception
{
new
TestDynMaxHeapFreeRatio
().
test
();
}
}
test/gc/arguments/TestDynMinHeapFreeRatio.java
0 → 100644
浏览文件 @
e0bece00
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test TestDynMinHeapFreeRatio
* @bug 8028391
* @summary Verify that MinHeapFreeRatio flag is manageable
* @library /testlibrary
* @run main TestDynMinHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMinHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 TestDynMinHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=51 -XX:MaxHeapFreeRatio=52 TestDynMinHeapFreeRatio
* @run main/othervm -XX:MinHeapFreeRatio=75 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio
*/
import
com.oracle.java.testlibrary.TestDynamicVMOption
;
import
com.oracle.java.testlibrary.DynamicVMOptionChecker
;
public
class
TestDynMinHeapFreeRatio
extends
TestDynamicVMOption
{
public
static
final
String
MinFreeRatioFlagName
=
"MinHeapFreeRatio"
;
public
static
final
String
MaxFreeRatioFlagName
=
"MaxHeapFreeRatio"
;
public
TestDynMinHeapFreeRatio
()
{
super
(
MinFreeRatioFlagName
);
}
public
void
test
()
{
int
maxHeapFreeValue
=
DynamicVMOptionChecker
.
getIntValue
(
MaxFreeRatioFlagName
);
System
.
out
.
println
(
MaxFreeRatioFlagName
+
" = "
+
maxHeapFreeValue
);
testPercentageValues
();
checkInvalidValue
(
Integer
.
toString
(
maxHeapFreeValue
+
1
));
checkValidValue
(
Integer
.
toString
(
maxHeapFreeValue
));
checkValidValue
(
"0"
);
}
public
static
void
main
(
String
args
[])
throws
Exception
{
new
TestDynMinHeapFreeRatio
().
test
();
}
}
test/testlibrary/com/oracle/java/testlibrary/DynamicVMOptionChecker.java
0 → 100644
浏览文件 @
e0bece00
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
com.oracle.java.testlibrary
;
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
java.lang.management.ManagementFactory
;
/**
* Simple class to check writeability, invalid and valid values for VMOption
*/
public
class
DynamicVMOptionChecker
{
/**
* Reads VM option from PlatformMXBean and parse it to integer value
*
* @param name of option
* @return parsed value
*/
public
static
int
getIntValue
(
String
name
)
{
VMOption
option
=
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
getVMOption
(
name
);
return
Integer
.
parseInt
(
option
.
getValue
());
}
/**
* Sets VM option value
*
* @param name of option
* @param value to set
*/
public
static
void
setIntValue
(
String
name
,
int
value
)
{
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
setVMOption
(
name
,
Integer
.
toString
(
value
));
}
/**
* Checks that VM option is dynamically writable
*
* @param name
* @throws RuntimeException if option if not writable
* @return always true
*/
public
static
boolean
checkIsWritable
(
String
name
)
{
VMOption
option
=
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
getVMOption
(
name
);
if
(!
option
.
isWriteable
())
{
throw
new
RuntimeException
(
name
+
" is not writable"
);
}
return
true
;
}
/**
* Checks that value cannot be set
*
* @param name of flag
* @param value string representation of value to set
* @throws RuntimeException on error - when expected exception hasn't been thrown
*/
public
static
void
checkInvalidValue
(
String
name
,
String
value
)
{
// should throw
try
{
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
setVMOption
(
name
,
value
);
}
catch
(
IllegalArgumentException
e
)
{
return
;
}
throw
new
RuntimeException
(
"Expected IllegalArgumentException was not thrown, "
+
name
+
"= "
+
value
);
}
/**
* Checks that value can be set
*
* @param name of flag to set
* @param value string representation of value to set
* @throws RuntimeException on error - when value in VM is not equal to origin
*/
public
static
void
checkValidValue
(
String
name
,
String
value
)
{
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
setVMOption
(
name
,
value
);
VMOption
option
=
ManagementFactory
.
getPlatformMXBean
(
HotSpotDiagnosticMXBean
.
class
).
getVMOption
(
name
);
if
(!
option
.
getValue
().
equals
(
value
))
{
throw
new
RuntimeException
(
"Actual value of "
+
name
+
" \""
+
option
.
getValue
()
+
"\" not equal origin \""
+
value
+
"\""
);
}
}
}
test/testlibrary/com/oracle/java/testlibrary/TestDynamicVMOption.java
0 → 100644
浏览文件 @
e0bece00
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
com.oracle.java.testlibrary
;
/**
* Simple class to check writeability, invalid and valid values for concrete VMOption
*/
public
class
TestDynamicVMOption
{
private
final
String
name
;
private
final
int
value
;
/**
* Constructor
*
* @param name of VM option to test
*/
public
TestDynamicVMOption
(
String
name
)
{
this
.
name
=
name
;
this
.
value
=
DynamicVMOptionChecker
.
getIntValue
(
name
);
System
.
out
.
println
(
this
.
name
+
" = "
+
this
.
value
);
}
/**
* Checks that this value can accept valid percentage values and cannot accept invalid percentage values
*
* @throws RuntimeException
*/
public
void
testPercentageValues
()
{
checkInvalidValue
(
Integer
.
toString
(
Integer
.
MIN_VALUE
));
checkInvalidValue
(
Integer
.
toString
(
Integer
.
MAX_VALUE
));
checkInvalidValue
(
"-10"
);
checkInvalidValue
(
"190"
);
}
/**
* Reads VM option from PlatformMXBean and parse it to integer value
*
* @return value
*/
public
int
getIntValue
()
{
return
DynamicVMOptionChecker
.
getIntValue
(
this
.
name
);
}
/**
* Sets VM option value
*
* @param value to set
*/
public
void
setIntValue
(
int
value
)
{
DynamicVMOptionChecker
.
setIntValue
(
this
.
name
,
value
);
}
/**
* Checks that this VM option is dynamically writable
*
* @throws RuntimeException if option if not writable
* @return true
*/
public
boolean
checkIsWritable
()
throws
RuntimeException
{
return
DynamicVMOptionChecker
.
checkIsWritable
(
this
.
name
);
}
/**
* Checks that value for this VM option cannot be set
*
* @param value to check
* @throws RuntimeException on error - when expected exception hasn't been thrown
*/
public
void
checkInvalidValue
(
String
value
)
{
DynamicVMOptionChecker
.
checkInvalidValue
(
this
.
name
,
value
);
}
/**
* Checks that value for this VM option can be set
*
* @param value to check
* @throws RuntimeException on error - when value in VM is not equal to origin
*/
public
void
checkValidValue
(
String
value
)
{
DynamicVMOptionChecker
.
checkValidValue
(
this
.
name
,
value
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录