Date: Wed, 23 Dec 2015 00:22:15 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r404270 - in head/java/openjdk8: . files Message-ID: <201512230022.tBN0MFIO012259@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Wed Dec 23 00:22:15 2015 New Revision: 404270 URL: https://svnweb.freebsd.org/changeset/ports/404270 Log: Implement ThreadMXBean.getThreadCpuTime(), etc. PR: 205523 Submitted by: will (via bsd-port-dev@openjdk.java.net) Added: head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp (contents, props changed) head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.hpp (contents, props changed) Modified: head/java/openjdk8/Makefile Modified: head/java/openjdk8/Makefile ============================================================================== --- head/java/openjdk8/Makefile Tue Dec 22 23:26:15 2015 (r404269) +++ head/java/openjdk8/Makefile Wed Dec 23 00:22:15 2015 (r404270) @@ -2,6 +2,7 @@ PORTNAME= openjdk PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//} +PORTREVISION= 1 CATEGORIES= java devel MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \ https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \ Added: head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp Wed Dec 23 00:22:15 2015 (r404270) @@ -0,0 +1,79 @@ +--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2015-12-22 22:54:16 UTC ++++ hotspot/src/os/bsd/vm/os_bsd.cpp +@@ -151,6 +151,7 @@ mach_timebase_info_data_t os::Bsd::_time + volatile uint64_t os::Bsd::_max_abstime = 0; + #else + int (*os::Bsd::_clock_gettime)(clockid_t, struct timespec *) = NULL; ++int (*os::Bsd::_getcpuclockid)(pthread_t, clockid_t *) = NULL; + #endif + pthread_t os::Bsd::_main_thread; + int os::Bsd::_page_size = -1; +@@ -1058,6 +1059,7 @@ void os::Bsd::clock_init() { + // yes, monotonic clock is supported + _clock_gettime = ::clock_gettime; + } ++ _getcpuclockid = (int (*)(pthread_t, clockid_t *))dlsym(RTLD_DEFAULT, "pthread_getcpuclockid"); + } + #endif + +@@ -4248,6 +4250,8 @@ jlong os::current_thread_cpu_time() { + #ifdef __APPLE__ + return os::thread_cpu_time(Thread::current(), true /* user + sys */); + #else ++ if (Bsd::_getcpuclockid != NULL) ++ return os::thread_cpu_time(Thread::current(), true /* user + sys */); + Unimplemented(); + return 0; + #endif +@@ -4257,6 +4261,8 @@ jlong os::thread_cpu_time(Thread* thread + #ifdef __APPLE__ + return os::thread_cpu_time(thread, true /* user + sys */); + #else ++ if (Bsd::_getcpuclockid != NULL) ++ return os::thread_cpu_time(thread, true /* user + sys */); + Unimplemented(); + return 0; + #endif +@@ -4266,6 +4272,8 @@ jlong os::current_thread_cpu_time(bool u + #ifdef __APPLE__ + return os::thread_cpu_time(Thread::current(), user_sys_cpu_time); + #else ++ if (Bsd::_getcpuclockid != NULL) ++ return os::thread_cpu_time(Thread::current(), user_sys_cpu_time); + Unimplemented(); + return 0; + #endif +@@ -4292,6 +4300,24 @@ jlong os::thread_cpu_time(Thread *thread + return ((jlong)tinfo.user_time.seconds * 1000000000) + ((jlong)tinfo.user_time.microseconds * (jlong)1000); + } + #else ++ if (Bsd::_getcpuclockid != NULL) { ++ struct timespec tp; ++ clockid_t clockid; ++ int ret; ++ ++ /* ++ * XXX This is essentially a copy of the Linux implementation, ++ * but with fewer indirections. ++ */ ++ ret = Bsd::_getcpuclockid(thread->osthread()->pthread_id(), &clockid); ++ if (ret != 0) ++ return -1; ++ /* NB: _clock_gettime only needs to be valid for CLOCK_MONOTONIC. */ ++ ret = ::clock_gettime(clockid, &tp); ++ if (ret != 0) ++ return -1; ++ return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec; ++ } + Unimplemented(); + return 0; + #endif +@@ -4316,7 +4342,7 @@ bool os::is_thread_cpu_time_supported() + #ifdef __APPLE__ + return true; + #else +- return false; ++ return (Bsd::_getcpuclockid != NULL); + #endif + } + Added: head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.hpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.hpp Wed Dec 23 00:22:15 2015 (r404270) @@ -0,0 +1,10 @@ +--- hotspot/src/os/bsd/vm/os_bsd.hpp.orig 2015-12-22 22:53:56 UTC ++++ hotspot/src/os/bsd/vm/os_bsd.hpp +@@ -64,6 +64,7 @@ class Bsd { + static volatile uint64_t _max_abstime; + #else + static int (*_clock_gettime)(clockid_t, struct timespec *); ++ static int (*_getcpuclockid)(pthread_t, clockid_t *); + #endif + + static GrowableArray<int>* _cpu_to_node;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512230022.tBN0MFIO012259>