Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ef6664a9
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ef6664a9
编写于
12月 07, 2018
作者:
E
egahlin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8212232: Wrong metadata for the configuration of the cutoff for old object sample events
Reviewed-by: mgronlun
上级
b31dfb75
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
28 deletion
+47
-28
src/share/classes/jdk/jfr/internal/Utils.java
src/share/classes/jdk/jfr/internal/Utils.java
+9
-1
src/share/classes/jdk/jfr/internal/settings/CutoffSetting.java
...hare/classes/jdk/jfr/internal/settings/CutoffSetting.java
+5
-13
src/share/classes/jdk/jfr/internal/settings/PeriodSetting.java
...hare/classes/jdk/jfr/internal/settings/PeriodSetting.java
+20
-7
src/share/classes/jdk/jfr/internal/settings/ThresholdSetting.java
...e/classes/jdk/jfr/internal/settings/ThresholdSetting.java
+13
-7
未找到文件。
src/share/classes/jdk/jfr/internal/Utils.java
浏览文件 @
ef6664a9
...
...
@@ -65,6 +65,8 @@ import jdk.jfr.internal.settings.ThresholdSetting;
public
final
class
Utils
{
private
static
final
String
INFINITY
=
"infinity"
;
private
static
Boolean
SAVE_GENERATED
;
public
static
final
String
EVENTS_PACKAGE_NAME
=
"jdk.jfr.events"
;
...
...
@@ -117,7 +119,6 @@ public final class Utils {
if
(
dValue
==
null
)
{
return
"0"
;
}
long
value
=
dValue
.
toNanos
();
TimespanUnit
result
=
TimespanUnit
.
NANOSECONDS
;
for
(
TimespanUnit
unit
:
TimespanUnit
.
values
())
{
...
...
@@ -131,6 +132,13 @@ public final class Utils {
return
String
.
format
(
"%d%s%s"
,
value
,
separation
,
result
.
text
);
}
public
static
long
parseTimespanWithInfinity
(
String
s
)
{
if
(
INFINITY
.
equals
(
s
))
{
return
Long
.
MAX_VALUE
;
}
return
parseTimespan
(
s
);
}
public
static
long
parseTimespan
(
String
s
)
{
if
(
s
.
endsWith
(
"ns"
))
{
return
Long
.
parseLong
(
s
.
substring
(
0
,
s
.
length
()
-
2
).
trim
());
...
...
src/share/classes/jdk/jfr/internal/settings/CutoffSetting.java
浏览文件 @
ef6664a9
...
...
@@ -28,11 +28,11 @@ package jdk.jfr.internal.settings;
import
java.util.Objects
;
import
java.util.Set
;
import
jdk.jfr.BooleanFlag
;
import
jdk.jfr.Description
;
import
jdk.jfr.Label
;
import
jdk.jfr.MetadataDefinition
;
import
jdk.jfr.Name
;
import
jdk.jfr.Timespan
;
import
jdk.jfr.internal.Control
;
import
jdk.jfr.internal.PlatformEventType
;
import
jdk.jfr.internal.Type
;
...
...
@@ -42,7 +42,7 @@ import jdk.jfr.internal.Utils;
@Label
(
"Cutoff"
)
@Description
(
"Limit running time of event"
)
@Name
(
Type
.
SETTINGS_PREFIX
+
"Cutoff"
)
@
BooleanFlag
@
Timespan
public
final
class
CutoffSetting
extends
Control
{
private
final
static
long
typeId
=
Type
.
getTypeId
(
CutoffSetting
.
class
);
...
...
@@ -59,7 +59,7 @@ public final class CutoffSetting extends Control {
long
max
=
0
;
String
text
=
"0 ns"
;
for
(
String
value
:
values
)
{
long
l
=
parseValue
(
value
);
long
l
=
Utils
.
parseTimespanWithInfinity
(
value
);
if
(
l
>
max
)
{
text
=
value
;
max
=
l
;
...
...
@@ -70,15 +70,11 @@ public final class CutoffSetting extends Control {
@Override
public
void
setValue
(
String
value
)
{
long
l
=
parseValue
(
value
);
long
l
=
Utils
.
parseTimespanWithInfinity
(
value
);
this
.
value
=
value
;
eventType
.
setCutoff
(
l
);
}
private
long
parseValue
(
String
value
)
{
return
isInfinity
(
value
)
?
Long
.
MAX_VALUE
:
Utils
.
parseTimespan
(
value
);
}
@Override
public
String
getValue
()
{
return
value
;
...
...
@@ -88,16 +84,12 @@ public final class CutoffSetting extends Control {
return
CutoffSetting
.
typeId
==
typeId
;
}
private
static
boolean
isInfinity
(
String
s
)
{
return
s
.
equals
(
"infinity"
);
}
public
static
long
parseValueSafe
(
String
value
)
{
if
(
value
==
null
)
{
return
0L
;
}
try
{
return
isInfinity
(
value
)
?
Long
.
MAX_VALUE
:
Utils
.
parseTimespan
(
value
);
return
Utils
.
parseTimespanWithInfinity
(
value
);
}
catch
(
NumberFormatException
nfe
)
{
return
0L
;
}
...
...
src/share/classes/jdk/jfr/internal/settings/PeriodSetting.java
浏览文件 @
ef6664a9
...
...
@@ -58,10 +58,11 @@ public final class PeriodSetting extends Control {
@Override
public
String
combine
(
Set
<
String
>
values
)
{
long
min
=
Long
.
MAX_VALUE
;
boolean
beginChunk
=
false
;
boolean
endChunk
=
false
;
String
text
=
EVERY_CHUNK
;
Long
min
=
null
;
String
text
=
null
;
for
(
String
value
:
values
)
{
switch
(
value
)
{
case
EVERY_CHUNK:
...
...
@@ -75,14 +76,21 @@ public final class PeriodSetting extends Control {
endChunk
=
true
;
break
;
default
:
long
l
=
Utils
.
parseTimespan
(
value
);
if
(
l
<
min
)
{
long
l
=
Utils
.
parseTimespanWithInfinity
(
value
);
// Always accept first specified value
if
(
min
==
null
)
{
text
=
value
;
min
=
l
;
}
else
{
if
(
l
<
min
)
{
text
=
value
;
min
=
l
;
}
}
}
}
if
(
min
!=
Long
.
MAX_VALUE
)
{
// A specified interval trumps *_CHUNK
if
(
min
!=
null
)
{
return
text
;
}
if
(
beginChunk
&&
!
endChunk
)
{
...
...
@@ -91,7 +99,7 @@ public final class PeriodSetting extends Control {
if
(!
beginChunk
&&
endChunk
)
{
return
END_CHUNK
;
}
return
text
;
return
EVERY_CHUNK
;
// also default
}
@Override
...
...
@@ -107,7 +115,12 @@ public final class PeriodSetting extends Control {
eventType
.
setPeriod
(
0
,
false
,
true
);
break
;
default
:
eventType
.
setPeriod
(
Utils
.
parseTimespan
(
value
)
/
1_000_000
,
false
,
false
);
long
nanos
=
Utils
.
parseTimespanWithInfinity
(
value
);
if
(
nanos
!=
Long
.
MAX_VALUE
)
{
eventType
.
setPeriod
(
nanos
/
1_000_000
,
false
,
false
);
}
else
{
eventType
.
setPeriod
(
Long
.
MAX_VALUE
,
false
,
false
);
}
}
this
.
value
=
value
;
}
...
...
src/share/classes/jdk/jfr/internal/settings/ThresholdSetting.java
浏览文件 @
ef6664a9
...
...
@@ -54,21 +54,27 @@ public final class ThresholdSetting extends Control {
@Override
public
String
combine
(
Set
<
String
>
values
)
{
long
min
=
Long
.
MAX_VALUE
;
String
text
=
"0 ns"
;
Long
min
=
null
;
String
text
=
null
;
for
(
String
value
:
values
)
{
long
l
=
Utils
.
parseTimespan
(
value
);
if
(
l
<
min
)
{
text
=
value
;
long
l
=
Utils
.
parseTimespan
WithInfinity
(
value
);
// always accept first value
if
(
min
==
null
)
{
min
=
l
;
text
=
value
;
}
else
{
if
(
l
<
min
)
{
text
=
value
;
min
=
l
;
}
}
}
return
text
;
return
text
==
null
?
"0 ns"
:
text
;
}
@Override
public
void
setValue
(
String
value
)
{
long
l
=
Utils
.
parseTimespan
(
value
);
long
l
=
Utils
.
parseTimespan
WithInfinity
(
value
);
this
.
value
=
value
;
eventType
.
setThreshold
(
l
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录