Mercurial > hg > openjdk > jdk8u > hotspot
changeset 9372:c80a6fd21394
8031126: java/lang/management/ThreadMXBean/ThreadUserTime.java fails intermittently
Reviewed-by: coleenp, simonis, goetz, gthornbr
author | sla |
---|---|
date | Mon, 05 May 2014 20:17:19 +0200 |
parents | 57803c5a2f13 |
children | db3b97029d3d |
files | src/os/linux/vm/os_linux.cpp |
diffstat | 1 files changed, 1 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Tue Nov 29 08:16:15 2016 +0100 +++ b/src/os/linux/vm/os_linux.cpp Mon May 05 20:17:19 2014 +0200 @@ -5801,7 +5801,6 @@ PRAGMA_DIAG_PUSH PRAGMA_FORMAT_NONLITERAL_IGNORED static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { - static bool proc_task_unchecked = true; pid_t tid = thread->osthread()->thread_id(); char *s; char stat[2048]; @@ -5814,24 +5813,7 @@ long ldummy; FILE *fp; - snprintf(proc_name, 64, "/proc/%d/stat", tid); - - // The /proc/<tid>/stat aggregates per-process usage on - // new Linux kernels 2.6+ where NPTL is supported. - // The /proc/self/task/<tid>/stat still has the per-thread usage. - // See bug 6328462. - // There possibly can be cases where there is no directory - // /proc/self/task, so we check its availability. - if (proc_task_unchecked && os::Linux::is_NPTL()) { - // This is executed only once - proc_task_unchecked = false; - fp = fopen("/proc/self/task", "r"); - if (fp != NULL) { - snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid); - fclose(fp); - } - } - + snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid); fp = fopen(proc_name, "r"); if ( fp == NULL ) return -1; statlen = fread(stat, 1, 2047, fp);