From 077e9f35c5ad98b5c62dbaeab8f339c913ee848e Mon Sep 17 00:00:00 2001 From: Jonas Norlinder Date: Mon, 15 Dec 2025 06:13:07 +0000 Subject: [PATCH] Backport dc1b0b5f81b6c3de85a0234d0315370b6413c077 --- src/hotspot/os/linux/os_linux.cpp | 7 ------- src/hotspot/share/runtime/os.hpp | 5 +---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 8d680f832f2..838b1d98b8a 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -4345,13 +4345,6 @@ OSReturn os::get_native_priority(const Thread* const thread, return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR); } -// This is the fastest way to get thread cpu time on Linux. -// Returns cpu time (user+sys) for any thread, not only for current. -// POSIX compliant clocks are implemented in the kernels 2.6.16+. -// It might work on 2.6.10+ with a special kernel/glibc patch. -// For reference, please, see IEEE Std 1003.1-2004: -// http://www.unix.org/single_unix_specification - jlong os::Linux::thread_cpu_time(clockid_t clockid) { struct timespec tp; int status = clock_gettime(clockid, &tp); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index b9fa5374e7d..3e273c87178 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -974,10 +974,7 @@ class os: AllStatic { // The thread_cpu_time() and current_thread_cpu_time() are only // supported if is_thread_cpu_time_supported() returns true. - // Thread CPU Time - return the fast estimate on a platform - // On Linux - fast clock_gettime where available - user+sys - // - otherwise: very slow /proc fs - user+sys - // On Windows - GetThreadTimes - user+sys + // Thread CPU Time - return the fast estimate on a platform - user+sys static jlong current_thread_cpu_time(); static jlong thread_cpu_time(Thread* t);