Skip to content

Commit 92ad8a1

Browse files
committedJan 8, 2025
8346052: JFR: Incorrect average value in 'jfr view'
Reviewed-by: mgronlun
1 parent 672c413 commit 92ad8a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/jdk.jfr/share/classes/jdk/jfr/internal/query/Function.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ public void add(Object value) {
175175
@Override
176176
public Object result() {
177177
if (count != 0) {
178-
long s = seconds / count;
179-
long n = nanos / count;
180-
return Duration.ofSeconds(s, n);
178+
double total = 1_000_000_000.0 * seconds + nanos;
179+
double average = total / count;
180+
return Duration.ofNanos(Math.round(average));
181181
} else {
182182
return null;
183183
}

0 commit comments

Comments
 (0)
Please sign in to comment.