feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
74
jdkSrc/jdk8/jdk/jfr/internal/settings/BooleanValue.java
Normal file
74
jdkSrc/jdk8/jdk/jfr/internal/settings/BooleanValue.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Helper class for settings that use boolean numbers
|
||||
*
|
||||
*/
|
||||
final class BooleanValue {
|
||||
private String value = "false";
|
||||
private boolean booleanValue;
|
||||
|
||||
private BooleanValue(boolean b) {
|
||||
booleanValue = b;
|
||||
value = b ? "true" : "false";
|
||||
}
|
||||
|
||||
public String union(Set<String> values) {
|
||||
for (String v : values) {
|
||||
if ("true".equals(v)) {
|
||||
return "true";
|
||||
}
|
||||
}
|
||||
return "false";
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
this.booleanValue = Boolean.valueOf(value);
|
||||
}
|
||||
|
||||
public final String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
public static BooleanValue valueOf(String defaultValue) {
|
||||
if ("true".equals(defaultValue)) {
|
||||
return new BooleanValue(true);
|
||||
}
|
||||
if ("false".equals(defaultValue)) {
|
||||
return new BooleanValue(false);
|
||||
}
|
||||
throw new InternalError("Unknown default value for settings '" + defaultValue + "'");
|
||||
}
|
||||
}
|
||||
97
jdkSrc/jdk8/jdk/jfr/internal/settings/CutoffSetting.java
Normal file
97
jdkSrc/jdk8/jdk/jfr/internal/settings/CutoffSetting.java
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
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;
|
||||
import jdk.jfr.internal.Utils;
|
||||
|
||||
@MetadataDefinition
|
||||
@Label("Cutoff")
|
||||
@Description("Limit running time of event")
|
||||
@Name(Type.SETTINGS_PREFIX + "Cutoff")
|
||||
@Timespan
|
||||
public final class CutoffSetting extends Control {
|
||||
private final static long typeId = Type.getTypeId(CutoffSetting.class);
|
||||
|
||||
private String value = "0 ns";
|
||||
private final PlatformEventType eventType;
|
||||
|
||||
public CutoffSetting(PlatformEventType eventType, String defaultValue) {
|
||||
super(defaultValue);
|
||||
this.eventType = Objects.requireNonNull(eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String combine(Set<String> values) {
|
||||
long max = 0;
|
||||
String text = "0 ns";
|
||||
for (String value : values) {
|
||||
long l = Utils.parseTimespanWithInfinity(value);
|
||||
if (l > max) {
|
||||
text = value;
|
||||
max = l;
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
long l = Utils.parseTimespanWithInfinity(value);
|
||||
this.value = value;
|
||||
eventType.setCutoff(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isType(long typeId) {
|
||||
return CutoffSetting.typeId == typeId;
|
||||
}
|
||||
|
||||
public static long parseValueSafe(String value) {
|
||||
if (value == null) {
|
||||
return 0L;
|
||||
}
|
||||
try {
|
||||
return Utils.parseTimespanWithInfinity(value);
|
||||
} catch (NumberFormatException nfe) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
75
jdkSrc/jdk8/jdk/jfr/internal/settings/EnabledSetting.java
Normal file
75
jdkSrc/jdk8/jdk/jfr/internal/settings/EnabledSetting.java
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.Description;
|
||||
import jdk.jfr.BooleanFlag;
|
||||
import jdk.jfr.Label;
|
||||
import jdk.jfr.MetadataDefinition;
|
||||
import jdk.jfr.Name;
|
||||
import jdk.jfr.internal.PlatformEventType;
|
||||
import jdk.jfr.internal.Type;
|
||||
import jdk.jfr.internal.Control;
|
||||
|
||||
@MetadataDefinition
|
||||
@Label("Enabled")
|
||||
@Description("Record event")
|
||||
@Name(Type.SETTINGS_PREFIX + "Enabled")
|
||||
@BooleanFlag
|
||||
public final class EnabledSetting extends Control {
|
||||
private final BooleanValue booleanValue;
|
||||
private final PlatformEventType eventType;
|
||||
|
||||
public EnabledSetting(PlatformEventType eventType, String defaultValue) {
|
||||
super(defaultValue);
|
||||
this.booleanValue = BooleanValue.valueOf(defaultValue);
|
||||
this.eventType = Objects.requireNonNull(eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String combine(Set<String> values) {
|
||||
return booleanValue.union(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
booleanValue.setValue(value);
|
||||
eventType.setEnabled(booleanValue.getBoolean());
|
||||
if (eventType.isEnabled() && !eventType.isJVM()) {
|
||||
if (!eventType.isInstrumented()) {
|
||||
eventType.markForInstrumentation(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return booleanValue.getValue();
|
||||
}
|
||||
}
|
||||
136
jdkSrc/jdk8/jdk/jfr/internal/settings/PeriodSetting.java
Normal file
136
jdkSrc/jdk8/jdk/jfr/internal/settings/PeriodSetting.java
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.Description;
|
||||
import jdk.jfr.Label;
|
||||
import jdk.jfr.MetadataDefinition;
|
||||
import jdk.jfr.Name;
|
||||
import jdk.jfr.internal.PlatformEventType;
|
||||
import jdk.jfr.internal.Control;
|
||||
import jdk.jfr.internal.Type;
|
||||
import jdk.jfr.internal.Utils;
|
||||
|
||||
@MetadataDefinition
|
||||
@Label("Period")
|
||||
@Description("Record event at interval")
|
||||
@Name(Type.SETTINGS_PREFIX + "Period")
|
||||
public final class PeriodSetting extends Control {
|
||||
private static final long typeId = Type.getTypeId(PeriodSetting.class);
|
||||
|
||||
public static final String EVERY_CHUNK = "everyChunk";
|
||||
public static final String BEGIN_CHUNK = "beginChunk";
|
||||
public static final String END_CHUNK = "endChunk";
|
||||
public static final String NAME = "period";
|
||||
private final PlatformEventType eventType;
|
||||
private String value = EVERY_CHUNK;
|
||||
|
||||
public PeriodSetting(PlatformEventType eventType, String defaultValue) {
|
||||
super(defaultValue);
|
||||
this.eventType = Objects.requireNonNull(eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String combine(Set<String> values) {
|
||||
|
||||
boolean beginChunk = false;
|
||||
boolean endChunk = false;
|
||||
Long min = null;
|
||||
String text = null;
|
||||
for (String value : values) {
|
||||
switch (value) {
|
||||
case EVERY_CHUNK:
|
||||
beginChunk = true;
|
||||
endChunk = true;
|
||||
break;
|
||||
case BEGIN_CHUNK:
|
||||
beginChunk = true;
|
||||
break;
|
||||
case END_CHUNK:
|
||||
endChunk = true;
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// A specified interval trumps *_CHUNK
|
||||
if (min != null) {
|
||||
return text;
|
||||
}
|
||||
if (beginChunk && !endChunk) {
|
||||
return BEGIN_CHUNK;
|
||||
}
|
||||
if (!beginChunk && endChunk) {
|
||||
return END_CHUNK;
|
||||
}
|
||||
return EVERY_CHUNK; // also default
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
switch (value) {
|
||||
case EVERY_CHUNK:
|
||||
eventType.setPeriod(0, true, true);
|
||||
break;
|
||||
case BEGIN_CHUNK:
|
||||
eventType.setPeriod(0, true, false);
|
||||
break;
|
||||
case END_CHUNK:
|
||||
eventType.setPeriod(0, false, true);
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isType(long typeId) {
|
||||
return PeriodSetting.typeId == typeId;
|
||||
}
|
||||
}
|
||||
75
jdkSrc/jdk8/jdk/jfr/internal/settings/StackTraceSetting.java
Normal file
75
jdkSrc/jdk8/jdk/jfr/internal/settings/StackTraceSetting.java
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.Description;
|
||||
import jdk.jfr.BooleanFlag;
|
||||
import jdk.jfr.Label;
|
||||
import jdk.jfr.MetadataDefinition;
|
||||
import jdk.jfr.Name;
|
||||
import jdk.jfr.internal.PlatformEventType;
|
||||
import jdk.jfr.internal.Control;
|
||||
import jdk.jfr.internal.Type;
|
||||
|
||||
@MetadataDefinition
|
||||
@Label("Stack Trace")
|
||||
@Name(Type.SETTINGS_PREFIX + "StackTrace")
|
||||
@Description("Record stack traces")
|
||||
@BooleanFlag
|
||||
public final class StackTraceSetting extends Control {
|
||||
private final static long typeId = Type.getTypeId(StackTraceSetting.class);
|
||||
private final BooleanValue booleanValue;
|
||||
private final PlatformEventType eventType;
|
||||
|
||||
public StackTraceSetting(PlatformEventType eventType, String defaultValue) {
|
||||
super(defaultValue);
|
||||
this.booleanValue = BooleanValue.valueOf(defaultValue);
|
||||
this.eventType = Objects.requireNonNull(eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String combine(Set<String> values) {
|
||||
return booleanValue.union(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
booleanValue.setValue(value);
|
||||
eventType.setStackTraceEnabled(booleanValue.getBoolean());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return booleanValue.getValue();
|
||||
}
|
||||
|
||||
public static boolean isType(long typeId) {
|
||||
return StackTraceSetting.typeId == typeId;
|
||||
}
|
||||
}
|
||||
90
jdkSrc/jdk8/jdk/jfr/internal/settings/ThresholdSetting.java
Normal file
90
jdkSrc/jdk8/jdk/jfr/internal/settings/ThresholdSetting.java
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.settings;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.Description;
|
||||
import jdk.jfr.Label;
|
||||
import jdk.jfr.MetadataDefinition;
|
||||
import jdk.jfr.Name;
|
||||
import jdk.jfr.Timespan;
|
||||
import jdk.jfr.internal.PlatformEventType;
|
||||
import jdk.jfr.internal.Control;
|
||||
import jdk.jfr.internal.Type;
|
||||
import jdk.jfr.internal.Utils;
|
||||
@MetadataDefinition
|
||||
@Label("Threshold")
|
||||
@Name(Type.SETTINGS_PREFIX + "Threshold")
|
||||
@Description("Record event with duration above or equal to threshold")
|
||||
@Timespan
|
||||
public final class ThresholdSetting extends Control {
|
||||
private final static long typeId = Type.getTypeId(ThresholdSetting.class);
|
||||
private String value = "0 ns";
|
||||
private final PlatformEventType eventType;
|
||||
|
||||
public ThresholdSetting(PlatformEventType eventType, String defaultValue) {
|
||||
super(defaultValue);
|
||||
this.eventType = Objects.requireNonNull(eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String combine(Set<String> values) {
|
||||
Long min = null;
|
||||
String text = null;
|
||||
for (String value : values) {
|
||||
long l = Utils.parseTimespanWithInfinity(value);
|
||||
// always accept first value
|
||||
if (min == null) {
|
||||
min = l;
|
||||
text = value;
|
||||
} else {
|
||||
if (l < min) {
|
||||
text = value;
|
||||
min = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
return text == null ? "0 ns" : text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
long l = Utils.parseTimespanWithInfinity(value);
|
||||
this.value = value;
|
||||
eventType.setThreshold(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isType(long typeId) {
|
||||
return ThresholdSetting.typeId == typeId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user