aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yasumasa Suenaga <suenaga@oss.nttdata.com> 2021-07-08 21:26:55 +0900
committerGravatar Yasumasa Suenaga <suenaga@oss.nttdata.com> 2021-07-08 21:26:55 +0900
commit74c53fe7961ea4c8dfe0eefc2dbecf2e8827eb6a (patch)
treef368c065f609daf82ab1f65c028b5a18675d3c10
parent4a45d95719bf68221e6843572511c2eb741ba69c (diff)
downloadjdk-pr/4724.tar.gz
jdk-pr/4724.zip
8270091: The path of JFR emergency dump should be able to specified by the userpr/4724
-rw-r--r--src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp9
-rw-r--r--src/hotspot/share/runtime/globals.hpp5
2 files changed, 13 insertions, 1 deletions
diff --git a/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp b/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp
index 0bcfc8568f5..17db6ef1975 100644
--- a/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp
+++ b/src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp
@@ -105,7 +105,14 @@ static void close_emergency_dump_file() {
static const char* create_emergency_dump_path() {
assert(is_path_empty(), "invariant");
- const size_t path_len = get_current_directory();
+ size_t path_len = 0;
+ if (JFREmergencyDumpPath == NULL) {
+ path_len = get_current_directory();
+ } else {
+ if (strlen(JFREmergencyDumpPath) < (sizeof(_path_buffer) - 1)) {
+ path_len = jio_snprintf(_path_buffer, sizeof(_path_buffer), "%s%s", JFREmergencyDumpPath, os::file_separator());
+ }
+ }
if (path_len == 0) {
return NULL;
}
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 72ce214b8bf..0597ef3b4d9 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -2035,6 +2035,11 @@ const intx ObjectAlignmentInBytes = 8;
JFR_ONLY(product(ccstr, StartFlightRecording, NULL, \
"Start flight recording with options")) \
\
+ JFR_ONLY(product(ccstr, JFREmergencyDumpPath, NULL, \
+ "The path for JFR emergency dump. " \
+ "Flight record will be dumped there " \
+ "when the error (OOM, stack overflow, crash) happens.")) \
+ \
product(bool, UseFastUnorderedTimeStamps, false, EXPERIMENTAL, \
"Use platform unstable time where supported for timestamps only") \
\