Skip to content
This repository was archived by the owner on Sep 29, 2021. It is now read-only.

Commit e68804a

Browse files
author
egahlin
committed
8199712: Flight Recorder
Reviewed-by: coleenp, ihse, erikj, dsamersoff, mseledtsov, egahlin, mgronlun Contributed-by: erik.gahlin@oracle.com, markus.gronlund@oracle.com
1 parent 24dbf55 commit e68804a

File tree

1,062 files changed

+119145
-3150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,062 files changed

+119145
-3150
lines changed

make/CompileJavaModules.gmk

+9
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,15 @@ jdk.localedata_COPY += _dict _th
509509
# Exclude BreakIterator classes that are just used in compile process to generate
510510
# data files and shouldn't go in the product
511511
jdk.localedata_EXCLUDE_FILES += sun/text/resources/ext/BreakIteratorRules_th.java
512+
################################################################################
513+
514+
# There is an issue in sjavac that triggers a warning in jdk.jfr that isn't
515+
# triggered without sjavac.
516+
ifeq ($(ENABLE_SJAVAC), yes)
517+
jdk.jfr_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
518+
endif
519+
jdk.jfr_COPY := .xsd .xml .dtd
520+
jdk.jfr_ADD_JAVAC_FLAGS := -XDstringConcat=inline -Xlint:-exports
512521

513522
################################################################################
514523
# If this is an imported module that has prebuilt classes, only compile

make/autoconf/hotspot.m4

+7-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# All valid JVM features, regardless of platform
2727
VALID_JVM_FEATURES="compiler1 compiler2 zero minimal dtrace jvmti jvmci \
2828
graal vm-structs jni-check services management cmsgc g1gc parallelgc serialgc nmt cds \
29-
static-build link-time-opt aot"
29+
static-build link-time-opt aot jfr"
3030

3131
# All valid JVM variants
3232
VALID_JVM_VARIANTS="server client minimal core zero custom"
@@ -309,6 +309,11 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
309309
AC_MSG_ERROR([Specified JVM feature 'cmsgc' requires feature 'serialgc'])
310310
fi
311311
312+
# Enable JFR by default, except on linux-sparcv9 and on minimal.
313+
if test "x$OPENJDK_TARGET_OS" != xlinux || test "x$OPENJDK_TARGET_CPU" != xsparcv9; then
314+
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jfr"
315+
fi
316+
312317
# Turn on additional features based on other parts of configure
313318
if test "x$INCLUDE_DTRACE" = "xtrue"; then
314319
JVM_FEATURES="$JVM_FEATURES dtrace"
@@ -396,7 +401,7 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
396401
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds"
397402
fi
398403
399-
# Enable default features depending on variant.
404+
# Enable features depending on variant.
400405
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
401406
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
402407
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"

make/autoconf/libraries.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
130130
131131
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
132132
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -ldemangle -lnsl \
133-
-lrt"
133+
-lrt -lkstat"
134134
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM"
135135
fi
136136

make/common/Modules.gmk

+4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ BOOT_MODULES += \
5959
java.security.sasl \
6060
java.xml \
6161
jdk.internal.vm.ci \
62+
jdk.jfr \
6263
jdk.management \
64+
jdk.management.jfr \
6365
jdk.management.agent \
6466
jdk.net \
6567
jdk.sctp \
@@ -152,13 +154,15 @@ DOCS_MODULES += \
152154
jdk.jdeps \
153155
jdk.jdi \
154156
jdk.jdwp.agent \
157+
jdk.jfr \
155158
jdk.jlink \
156159
jdk.jsobject \
157160
jdk.jshell \
158161
jdk.jstatd \
159162
jdk.localedata \
160163
jdk.management \
161164
jdk.management.agent \
165+
jdk.management.jfr \
162166
jdk.naming.dns \
163167
jdk.naming.rmi \
164168
jdk.net \

make/copy/Copy-jdk.jfr.gmk

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation. Oracle designates this
8+
# particular file as subject to the "Classpath" exception as provided
9+
# by Oracle in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, write to the Free Software Foundation,
19+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
#
21+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
# or visit www.oracle.com if you need additional information or have any
23+
# questions.
24+
#
25+
26+
include CopyCommon.gmk
27+
28+
################################################################################
29+
30+
$(eval $(call SetupCopyFiles, COPY_JFR_METADATA, \
31+
SRC := $(TOPDIR)/src/hotspot/share/jfr/metadata, \
32+
DEST := $(JDK_OUTPUTDIR)/modules/jdk.jfr/jdk/jfr/internal/types, \
33+
FILES := metadata.xml \
34+
))
35+
36+
TARGETS += $(COPY_JFR_METADATA)
37+
38+
JFR_CONF_DIR := $(TOPDIR)/src/jdk.jfr/share/conf/jfr
39+
$(eval $(call SetupCopyFiles, COPY_JFR_CONF, \
40+
DEST := $(LIB_DST_DIR)/jfr, \
41+
FILES := $(wildcard $(JFR_CONF_DIR)/*.jfc), \
42+
FLATTEN := true, \
43+
))
44+
TARGETS += $(COPY_JFR_CONF)
45+
46+
################################################################################

make/hotspot/gensrc/GenerateSources.gmk

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ include HotspotCommon.gmk
3838
include gensrc/GensrcAdlc.gmk
3939
include gensrc/GensrcDtrace.gmk
4040
include gensrc/GensrcJvmti.gmk
41+
include gensrc/GensrcJfr.gmk
4142

4243
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GenerateSources.gmk))
4344

make/hotspot/gensrc/GensrcJfr.gmk

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#
2+
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation. Oracle designates this
8+
# particular file as subject to the "Classpath" exception as provided
9+
# by Oracle in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, write to the Free Software Foundation,
19+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
#
21+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
# or visit www.oracle.com if you need additional information or have any
23+
# questions.
24+
#
25+
26+
$(eval $(call IncludeCustomExtension, hotspot/gensrc/GensrcJfr.gmk))
27+
28+
################################################################################
29+
# Build tools needed for the Jfr source code generation
30+
31+
JFR_TOOLS_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
32+
JFR_TOOLS_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/tools/jfr
33+
34+
$(eval $(call SetupJavaCompiler, GENERATE_JFRBYTECODE, \
35+
JAVAC := $(JAVAC), \
36+
FLAGS := $(DISABLE_WARNINGS), \
37+
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
38+
SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
39+
DISABLE_SJAVAC := true, \
40+
))
41+
42+
$(eval $(call SetupJavaCompilation, BUILD_JFR_TOOLS, \
43+
SETUP := GENERATE_JFRBYTECODE, \
44+
SRC := $(JFR_TOOLS_SRCDIR), \
45+
INCLUDE_FILES := GenerateJfrFiles.java, \
46+
BIN := $(JFR_TOOLS_OUTPUTDIR), \
47+
))
48+
49+
TOOL_JFR_GEN := $(JAVA_SMALL) -cp $(JFR_TOOLS_OUTPUTDIR) GenerateJfrFiles
50+
51+
################################################################################
52+
# Setup make rules for Jfr file file generation.
53+
#
54+
# Parameter 1 is the name of the rule. This name is used as variable prefix,
55+
# and the targets generated are listed in a variable by that name. This name is
56+
# also used as the name of the output file.
57+
#
58+
# Remaining parameters are named arguments. These include:
59+
# XML_FILE -- The input source file to use
60+
# XSD_FILE -- The input schema for validation
61+
# OUTPUT_DIR -- The directory to put the generated file in
62+
SetupJfrGeneration = $(NamedParamsMacroTemplate)
63+
define SetupJfrGenerationBody
64+
$$($1_OUTPUT_DIR)/$1: $$($1_XML_FILE) $$($1_XSD_FILE) $$(BUILD_JFR_TOOLS)
65+
$$(call LogInfo, Generating $$(@F))
66+
$$(call MakeDir, $$(@D))
67+
$$(call ExecuteWithLog, $$@, $$(TOOL_JFR_GEN) $$($1_XML_FILE) $$($1_XSD_FILE) $$($1_OUTPUT_DIR))
68+
test -f $$@
69+
70+
TARGETS += $$($1_OUTPUT_DIR)/$1
71+
72+
endef
73+
74+
################################################################################
75+
# Create files in gensrc/jfrfiles
76+
77+
JFR_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jfrfiles
78+
JFR_SRCDIR := $(TOPDIR)/src/hotspot/share/jfr/metadata
79+
80+
METADATA_XML ?= $(JFR_SRCDIR)/metadata.xml
81+
METADATA_XSD ?= $(JFR_SRCDIR)/metadata.xsd
82+
83+
# Changing these will trigger a rebuild of generated jfr files.
84+
JFR_DEPS += \
85+
$(METADATA_XML) \
86+
$(METADATA_XSD) \
87+
#
88+
89+
# our generator will generate all files in one go, so only need to setup one target rule
90+
$(eval $(call SetupJfrGeneration, jfrEventClasses.hpp, \
91+
XML_FILE := $(METADATA_XML), \
92+
XSD_FILE := $(METADATA_XSD), \
93+
OUTPUT_DIR := $(JFR_OUTPUTDIR), \
94+
))

make/hotspot/gensrc/GensrcJvmti.gmk

+2-47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ TOOL_JVMTI_GEN := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiGen
5050
TOOL_JVMTI_ENV_FILL := $(JAVA_SMALL) -cp $(JVMTI_TOOLS_OUTPUTDIR) jvmtiEnvFill
5151

5252
################################################################################
53-
# Setup make rules for an xml transform for jvmti/trace file generation.
53+
# Setup make rules for an xml transform for jvmti file generation.
5454
#
5555
# Parameter 1 is the name of the rule. This name is used as variable prefix,
5656
# and the targets generated are listed in a variable by that name. This name is
@@ -126,48 +126,3 @@ ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
126126

127127
TARGETS += $(COPY_JVMTI_H)
128128
endif
129-
130-
################################################################################
131-
# Create trace files in gensrc/tracefiles
132-
133-
TRACE_OUTPUTDIR := $(JVM_VARIANT_OUTPUTDIR)/gensrc/tracefiles
134-
TRACE_SRCDIR := $(TOPDIR)/src/hotspot/share/trace
135-
136-
# Append list of XSL files to search (might have been set by custom extensions)
137-
TRACE_XSL_FILES += $(wildcard $(TRACE_SRCDIR)/*.xsl)
138-
139-
TRACE_XML ?= $(TRACE_SRCDIR)/trace.xml
140-
141-
# Changing these will trigger a rebuild of generated trace files.
142-
TRACE_DEPS += \
143-
$(TRACE_XML) \
144-
$(TRACE_SRCDIR)/tracetypes.xml \
145-
$(TRACE_SRCDIR)/tracerelationdecls.xml \
146-
$(TRACE_SRCDIR)/traceevents.xml \
147-
$(TRACE_SRCDIR)/trace.dtd \
148-
$(TRACE_SRCDIR)/xinclude.mod \
149-
#
150-
151-
# Setup rule for generating a trace file
152-
#
153-
# $1 is generated source file name in $(TRACE_OUTPUTDIR)
154-
define SetupTraceGeneration
155-
$$(eval $$(call SetupXslTransform, $1, \
156-
XML_FILE := $$(TRACE_XML), \
157-
XSL_FILE := $$(firstword $$(filter %/$$(basename $1).xsl, $$(TRACE_XSL_FILES))), \
158-
OUTPUT_DIR := $$(TRACE_OUTPUTDIR), \
159-
DEPS := $$(TRACE_DEPS), \
160-
))
161-
endef
162-
163-
# Append files to generated (might have been set by custom extensions)
164-
TRACE_GENSRC_FILES += \
165-
traceEventClasses.hpp \
166-
traceEventIds.hpp \
167-
traceTypes.hpp \
168-
#
169-
170-
# Call SetupTraceGeneration for all trace gensrc files
171-
$(foreach tracefile, $(TRACE_GENSRC_FILES), \
172-
$(eval $(call SetupTraceGeneration, $(tracefile))) \
173-
)

make/hotspot/lib/JvmFeatures.gmk

+6
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ ifneq ($(call check-jvm-feature, serialgc), true)
154154
# If serial is disabled, we cannot use serial as OldGC in parallel
155155
JVM_EXCLUDE_FILES += psMarkSweep.cpp psMarkSweepDecorator.cpp
156156
endif
157+
158+
ifneq ($(call check-jvm-feature, jfr), true)
159+
JVM_CFLAGS_FEATURES += -DINCLUDE_JFR=0
160+
JVM_EXCLUDE_PATTERNS += jfr
161+
endif
162+
157163
################################################################################
158164

159165
ifeq ($(call check-jvm-feature, link-time-opt), true)

make/hotspot/src/classes/build/tools/projectcreator/BuildConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void initDefaultDefines(Vector defines) {
223223
sysDefines.add("_WINDOWS");
224224
sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
225225
sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
226-
sysDefines.add("INCLUDE_TRACE=1");
226+
sysDefines.add("INCLUDE_JFR=1");
227227
sysDefines.add("_JNI_IMPLEMENTATION_");
228228
if (vars.get("PlatformName").equals("Win32")) {
229229
sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");

make/jprt.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -273,6 +273,7 @@ my.make.rule.test.targets.svc= \
273273
${my.test.target.set:TESTNAME=jdk_instrument}, \
274274
${my.test.target.set:TESTNAME=jdk_jmx}, \
275275
${my.test.target.set:TESTNAME=jdk_jdi}, \
276+
${my.test.target.set:TESTNAME=jdk_jfr}, \
276277
${my.test.target.set:TESTNAME=svc_tools}, \
277278
${my.make.rule.test.targets.svc.extra}
278279

make/nashorn/project.properties

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -98,8 +98,8 @@ dist.javadoc.dir=${dist.dir}/javadoc
9898
dist.nashornapi.javadoc.dir=${dist.javadoc.dir}/nashornapi
9999
dist.dynalinkapi.javadoc.dir=${dist.javadoc.dir}/dynalinkapi
100100

101-
# configuration for java flight recorder
102-
run.test.jvmargs.jfr=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128
101+
# configuration for flight recorder
102+
run.test.jvmargs.jfr=XX:StartFlightRecording=disk=true,dumponexit=true,dumponexitpath=${build.dir},stackdepth=128
103103

104104
# test library location
105105
test.lib=test/nashorn/lib
@@ -354,7 +354,7 @@ run.test.xms=2G
354354
# uncomment this jfr.args to enable light recordings. the stack needs to be cranked up to 1024 frames,
355355
# or everything will as of the now drown in lambda forms and be cut off.
356356
#
357-
#jfr.args=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,dumponexit=true,dumponexitpath="test_suite.jfr",stackdepth=1024 \
357+
#jfr.args=-XX:StartFlightRecording=disk=true,dumponexit=true,dumponexitpath="test_suite.jfr",stackdepth=1024
358358

359359
jfr.args=
360360

0 commit comments

Comments
 (0)