Tue, 28 Jul 2020 09:48:19 +0200
8243489: Thread CPU Load event may contain wrong data for CPU time under certain conditions
Reviewed-by: jbachorik
Contributed-by: Nikolay Martynov <nikolay.martynov@datadoghq.com>
src/share/vm/jfr/periodic/jfrThreadCPULoadEvent.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/jfr/periodic/jfrThreadCPULoadEvent.cpp Fri Jul 24 13:37:11 2020 +0100 1.2 +++ b/src/share/vm/jfr/periodic/jfrThreadCPULoadEvent.cpp Tue Jul 28 09:48:19 2020 +0200 1.3 @@ -86,15 +86,14 @@ 1.4 // Avoid reporting percentages above the theoretical max 1.5 if (user_time + system_time > wallclock_time) { 1.6 jlong excess = user_time + system_time - wallclock_time; 1.7 + cur_cpu_time -= excess; 1.8 if (user_time > excess) { 1.9 user_time -= excess; 1.10 cur_user_time -= excess; 1.11 - cur_cpu_time -= excess; 1.12 } else { 1.13 - cur_cpu_time -= excess; 1.14 excess -= user_time; 1.15 + cur_user_time -= user_time; 1.16 user_time = 0; 1.17 - cur_user_time = 0; 1.18 system_time -= excess; 1.19 } 1.20 }