-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8286441: Remove mode parameter from jdk.internal.perf.Perf.attach() #8622
8286441: Remove mode parameter from jdk.internal.perf.Perf.attach() #8622
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
@iklam The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
} | ||
|
||
FileChannel fc = new RandomAccessFile(f, "r").getChannel(); | ||
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0L, (int)fc.size()); | ||
fc.close(); // doesn't need to remain open |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can change this to:
try (FileChannel fc = FileChannel.open(f.toPath())) {
ByteBuffer bb = ...
createPerfDataBuffer(bb, 0);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
I skimmed through the changes and I think they look okay. In the distant past there were tools outside of the JDK that used the jvmstat API directly. It's possible that VisualVM still does but it would only compile/run if --add-exports is used to export the sun.jvmstat.* packages. So it might be that dropping the parameter from a method in RemoteHost is noticed and I think that is okay because this package is not exported and is not meant to be used by code outside of the JDK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup!
(Some stylistic suggestions inline, feel free to ignore)
@@ -67,17 +67,13 @@ public RemoteHostImpl(int rmiPort) throws MonitorException { | |||
monitoredHost.addHostListener(this); | |||
} | |||
|
|||
public RemoteVm attachVm(int lvmid, String mode) | |||
public RemoteVm attachVm(int lvmid) | |||
throws RemoteException, MonitorException { | |||
Integer v = lvmid; | |||
RemoteVm stub = null; | |||
StringBuilder sb = new StringBuilder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringBuilder sb = new StringBuilder(); | |
String vmidStr = "local://" + lvmid + "@localhost"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -148,7 +143,7 @@ class PerfMemory : AllStatic { | |||
|
|||
// methods for attaching to and detaching from the PerfData | |||
// memory segment of another JVM process on the same system. | |||
static void attach(const char* user, int vmid, PerfMemoryMode mode, | |||
static void attach(const char* user, int vmid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/hotspot/share/prims/perf.cpp
Outdated
// attach to the PerfData memory region for the specified VM | ||
PerfMemory::attach(user_utf, vmid, (PerfMemory::PerfMemoryMode) mode, | ||
PerfMemory::attach(user_utf, vmid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -1796,7 +1778,7 @@ void PerfMemory::delete_memory_region() { | |||
// the indicated process's PerfData memory region into this JVMs | |||
// address space. | |||
// | |||
void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode, | |||
void PerfMemory::attach(const char* user, int vmid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@iklam This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 48 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
The APIs changed by this PR are:
I checked the latest VisualVM source code. Some of the above classes are referenced, but none of the affected APIs are called. |
Thanks to @AlanBateman and @cl4es for the review. |
Going to push as commit fcf49f4.
Your commit was automatically rebased without conflicts. |
The
mode
parameter forjdk.internal.perf.Perf.attach()
has never supported the value"rw"
since the source code was imported to the openjdk repo more than 15 years ago. In fact HotSpot throwsIllegalArgumentException
when such a mode is specified.It's unlikely such a mode will be required for future enhancements. Support for
"rw"
is removed. The "mode" parameter is also removed, since now"r"
is the only supported mode.I also cleaned up related code in the JDK and HotSpot.
Testing:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8622/head:pull/8622
$ git checkout pull/8622
Update a local copy of the PR:
$ git checkout pull/8622
$ git pull https://git.openjdk.java.net/jdk pull/8622/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8622
View PR using the GUI difftool:
$ git pr show -t 8622
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8622.diff