代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/openjdk-1.8.0 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ef5d7213507f8148ae0b3fd7f82ea4afa5695d72 Mon Sep 17 00:00:00 2001
From: hubodao <hubodao@huawei.com>
Date: Sat, 11 Sep 2021 09:56:54 +0800
Subject: [PATCH 13/23] create jfr dump file with pid or timestamp if specified
Summary: <JFR> : create jfr dump file with pid or timestamp if specified
LLT: NA
Patch Type: huawei
Bug url: NA
---
hotspot/src/share/vm/jfr/dcmd/jfrDcmds.cpp | 16 ++++++++++++++--
.../jdk/jfr/jcmd/TestJcmdDumpWithFileName.java | 16 ++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/jfr/dcmd/jfrDcmds.cpp b/hotspot/src/share/vm/jfr/dcmd/jfrDcmds.cpp
index 167405e39..9585de28c 100644
--- a/hotspot/src/share/vm/jfr/dcmd/jfrDcmds.cpp
+++ b/hotspot/src/share/vm/jfr/dcmd/jfrDcmds.cpp
@@ -226,7 +226,13 @@ void JfrDumpFlightRecordingDCmd::execute(DCmdSource source, TRAPS) {
jstring filepath = NULL;
if (_filename.is_set() && _filename.value() != NULL) {
- filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ const char* extended_path = make_log_name(_filename.value(), NULL);
+ if (extended_path != NULL) {
+ filepath = JfrJavaSupport::new_string(extended_path, CHECK);
+ FREE_C_HEAP_ARRAY(char, extended_path, mtInternal);
+ } else {
+ filepath = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ }
}
jobject maxage = NULL;
@@ -394,7 +400,13 @@ void JfrStartFlightRecordingDCmd::execute(DCmdSource source, TRAPS) {
jstring filename = NULL;
if (_filename.is_set() && _filename.value() != NULL) {
- filename = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ const char* dumpPath = make_log_name(_filename.value(), NULL);
+ if (dumpPath != NULL) {
+ filename = JfrJavaSupport::new_string(dumpPath, CHECK);
+ FREE_C_HEAP_ARRAY(char, dumpPath, mtInternal);
+ } else {
+ filename = JfrJavaSupport::new_string(_filename.value(), CHECK);
+ }
}
jobject maxage = NULL;
diff --git a/jdk/test/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java b/jdk/test/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
index 40ff35b4d..f0c39564f 100644
--- a/jdk/test/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
+++ b/jdk/test/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java
@@ -48,6 +48,7 @@ public class TestJcmdDumpWithFileName {
testDumpAll();
testDumpNamed();
testDumpNamedWithFilename();
+ testDumpNamedWithFilenameExpansion();
}
private static void testDumpAll() throws Exception {
@@ -96,6 +97,21 @@ public class TestJcmdDumpWithFileName {
}
cleanup();
}
+
+ private static void testDumpNamedWithFilenameExpansion() throws Exception {
+ long pid = ProcessTools.getProcessId();
+ Path dumpPath = Paths.get("dumpPath-%p-%t.jfr").toAbsolutePath();
+ try (Recording r = new Recording()) {
+ r.setName("testDumpNamedWithFilenameExpansion");
+ r.setDestination(dumpPath);
+ r.start();
+ JcmdHelper.jcmd("JFR.dump", "name=testDumpNamedWithFilenameExpansion", "filename=" + dumpPath.toString());
+ Stream<Path> stream = Files.find(Paths.get("."), 1, (s, a) -> s.toString()
+ .matches("^.*dumpPath-pid" + pid + ".\\d{4}.\\d{2}.\\d{2}.\\d{2}.\\d{2}.\\d{2}" + ".jfr") && (a.size() > 0L));
+ Asserts.assertTrue(stream.findAny().isPresent());
+ }
+ cleanup();
+ }
private static boolean namedFile(Path dumpFile) throws IOException {
return Files.exists(dumpFile) && (Files.size(dumpFile) > 0);
--
2.22.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。