-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
JDK-8273979: move some os time related functions to os_posix for POSIX platforms #5582
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
Webrevs
|
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.
Hi Matthias,
Generally this refactoring looks good, though I have a request to restore some of the code - see comments below. Also could you clarify where functions were only "pretty similar" rather than identical as we don't want to introduce subtle incompatibilities.
I think supports_vtime() could probably be removed in a separate RFE.
Thanks,
David
src/hotspot/os/aix/os_aix.cpp
Outdated
@@ -994,49 +977,6 @@ jlong os::javaTimeNanos() { | |||
} | |||
} | |||
|
|||
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) { |
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.
Please restore this. As has been discussed in previous refactorings in this code if there is a platform specific definition of javaTimeNanos then we should keep the platform specific definition of javaTimeNanos_info, even if it happens to be the same as on other platforms. Otherwise if the javaTimeNanos code were changed one would not realise they also may have to change javaTimenanos_info.
src/hotspot/os/bsd/os_bsd.cpp
Outdated
@@ -804,52 +784,8 @@ jlong os::javaTimeNanos() { | |||
// See https://blogs.oracle.com/dave/entry/cas_and_cache_trivia_invalidate | |||
return (prev == obsv) ? now : obsv; | |||
} | |||
|
|||
void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) { |
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.
Please restore as per previous comment.
src/hotspot/os/posix/os_posix.cpp
Outdated
#if defined(_ALLBSD_SOURCE) | ||
static int clock_tics_per_sec = CLK_TCK; | ||
#else | ||
static int clock_tics_per_sec = 100; | ||
#endif |
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.
Can't we just defer the conditional initialization to the init() function where we already have to conditionally initialise.
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.
Thanks Matthias - updates look good.
David
@MBaesken 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 44 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 |
Hi David, I brought back os::javaTimeNanos_info following your suggestion and adjusted the initialization of 'clock_tics_per_sec ' in os_posix.
Sure, went through them and this is what I found
OK, I opened https://bugs.openjdk.java.net/browse/JDK-8274051 . |
@@ -171,8 +171,6 @@ os::Linux::mallinfo_func_t os::Linux::_mallinfo = NULL; | |||
os::Linux::mallinfo2_func_t os::Linux::_mallinfo2 = NULL; | |||
#endif // __GLIBC__ | |||
|
|||
static jlong initial_time_count=0; | |||
|
|||
static int clock_tics_per_sec = 100; | |||
|
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.
In os_linux.cpp, clock_tics_per_sec is used for elapsed time calculations as well as for cpu time calculations. In addition, clock_tics_per_sec is set (reinitialised) in os::init(). Are we sure that _SC_CLK_TCK evaluates to 100? If no, do we then potentially calculate wrong elapsed times after moving the code to os_posix?
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.
My previous comment about clock_ticks_per_sec is obsolete. Just saw the initialisation in os::Posix::init(void) now is the same as in os::init(). The static init value is in effect only for the short time until os::init() is invoked.
Looks good to me.
Hi Lutz, thanks for the review . Best regards, Matthias |
I would not add this complexity. Just leave it as it is. |
/integrate |
Going to push as commit 1c6fa11.
Your commit was automatically rebased without conflicts. |
/backport jdk17u-dev |
@rvansa the backport was successfully created on the branch backport-rvansa-1c6fa113-master in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link: The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:
If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:
|
There are a couple of time related functions in os_ for Linux, BSD+Mac and AIX that are pretty similar (or identical) across the platforms and can be centralized in os_posix .
While doing so, I noticed that os::supports_vtime() returns always true , on Posix and also on Windows, so we might remove it completely if this prefered ?
Best regards , Matthias
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5582/head:pull/5582
$ git checkout pull/5582
Update a local copy of the PR:
$ git checkout pull/5582
$ git pull https://git.openjdk.java.net/jdk pull/5582/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5582
View PR using the GUI difftool:
$ git pr show -t 5582
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5582.diff