Date: Tue, 5 Jan 2016 22:39:47 +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: r405320 - in head/java/openjdk8: . files Message-ID: <201601052239.u05Mdljo098259@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Tue Jan 5 22:39:46 2016 New Revision: 405320 URL: https://svnweb.freebsd.org/changeset/ports/405320 Log: - Partially implement getThreadUserTime() using getrusage(2). Note we can only get usage for the current thread. Return -1 if the requested function is not supported, i.e., user time for other threads, rather than crash. [1] - Properly implement os::elapsedVTime() using getrusage(). Basically, it is taken from Linux version. - Temporarily revert r403748 to fix bootstrapping with earlier OpenJDK8. [2] PR: 205523, 205843 [1] PR: 205544 [2] Modified: head/java/openjdk8/Makefile head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp Modified: head/java/openjdk8/Makefile ============================================================================== --- head/java/openjdk8/Makefile Tue Jan 5 21:50:35 2016 (r405319) +++ head/java/openjdk8/Makefile Tue Jan 5 22:39:46 2016 (r405320) @@ -2,7 +2,7 @@ PORTNAME= openjdk PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//} -PORTREVISION= 2 +PORTREVISION= 3 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 \ @@ -331,10 +331,6 @@ BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/ . endif .endif -.if ${BOOTSTRAPJDKDIR} == ${LOCALBASE}/openjdk8 -CONFIGURE_ARGS+= --enable-sjavac -.endif - # PR193009: work around the rtld bug .if ${OSVERSION} < 1001511 CONFIGURE_ARGS+= --enable-static-libjli Modified: head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp ============================================================================== --- head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp Tue Jan 5 21:50:35 2016 (r405319) +++ head/java/openjdk8/files/patch-hotspot_src_os_bsd_vm_os__bsd.cpp Tue Jan 5 22:39:46 2016 (r405320) @@ -1,4 +1,4 @@ ---- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2015-12-22 22:54:16 UTC +--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2016-01-05 21:15:40 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; @@ -8,7 +8,21 @@ #endif pthread_t os::Bsd::_main_thread; int os::Bsd::_page_size = -1; -@@ -1058,6 +1059,7 @@ void os::Bsd::clock_init() { +@@ -1028,6 +1029,13 @@ bool os::enable_vtime() { return false + bool os::vtime_enabled() { return false; } + + double os::elapsedVTime() { ++#ifdef RUSAGE_THREAD ++ struct rusage usage; ++ int retval = getrusage(RUSAGE_THREAD, &usage); ++ if (retval == 0) { ++ return (double) (usage.ru_utime.tv_sec + usage.ru_stime.tv_sec) + (double) (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000 * 1000); ++ } ++#endif + // better than nothing, but not much + return elapsedTime(); + } +@@ -1058,6 +1066,7 @@ void os::Bsd::clock_init() { // yes, monotonic clock is supported _clock_gettime = ::clock_gettime; } @@ -16,37 +30,48 @@ } #endif -@@ -4248,6 +4250,8 @@ jlong os::current_thread_cpu_time() { +@@ -4248,8 +4257,9 @@ jlong os::current_thread_cpu_time() { #ifdef __APPLE__ return os::thread_cpu_time(Thread::current(), true /* user + sys */); #else +- Unimplemented(); +- return 0; + if (Bsd::_getcpuclockid != NULL) + return os::thread_cpu_time(Thread::current(), true /* user + sys */); - Unimplemented(); - return 0; ++ return -1; #endif -@@ -4257,6 +4261,8 @@ jlong os::thread_cpu_time(Thread* thread + } + +@@ -4257,8 +4267,9 @@ jlong os::thread_cpu_time(Thread* thread #ifdef __APPLE__ return os::thread_cpu_time(thread, true /* user + sys */); #else +- Unimplemented(); +- return 0; + if (Bsd::_getcpuclockid != NULL) + return os::thread_cpu_time(thread, true /* user + sys */); - Unimplemented(); - return 0; ++ return -1; #endif -@@ -4266,6 +4272,8 @@ jlong os::current_thread_cpu_time(bool u + } + +@@ -4266,8 +4277,9 @@ jlong os::current_thread_cpu_time(bool u #ifdef __APPLE__ return os::thread_cpu_time(Thread::current(), user_sys_cpu_time); #else +- Unimplemented(); +- return 0; + if (Bsd::_getcpuclockid != NULL) + return os::thread_cpu_time(Thread::current(), user_sys_cpu_time); - Unimplemented(); - return 0; ++ return -1; #endif -@@ -4292,6 +4300,24 @@ jlong os::thread_cpu_time(Thread *thread + } + +@@ -4292,8 +4304,41 @@ jlong os::thread_cpu_time(Thread *thread return ((jlong)tinfo.user_time.seconds * 1000000000) + ((jlong)tinfo.user_time.microseconds * (jlong)1000); } #else +- Unimplemented(); +- return 0; + if (user_sys_cpu_time && Bsd::_getcpuclockid != NULL) { + struct timespec tp; + clockid_t clockid; @@ -65,10 +90,27 @@ + return -1; + return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec; + } - Unimplemented(); - return 0; ++#ifdef RUSAGE_THREAD ++ if (thread == Thread::current()) { ++ struct rusage usage; ++ jlong nanos; ++ ++ if (getrusage(RUSAGE_THREAD, &usage) != 0) ++ return -1; ++ nanos = (jlong)usage.ru_utime.tv_sec * NANOSECS_PER_SEC; ++ nanos += (jlong)usage.ru_utime.tv_usec * 1000; ++ if (user_sys_cpu_time) { ++ nanos += (jlong)usage.ru_stime.tv_sec * NANOSECS_PER_SEC; ++ nanos += (jlong)usage.ru_stime.tv_usec * 1000; ++ } ++ return nanos; ++ } ++#endif ++ return -1; #endif -@@ -4316,7 +4342,7 @@ bool os::is_thread_cpu_time_supported() + } + +@@ -4316,7 +4361,7 @@ bool os::is_thread_cpu_time_supported() #ifdef __APPLE__ return true; #else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601052239.u05Mdljo098259>