Skip to content

Commit 9c620e4

Browse files
committed
8372704: ThreadMXBean.getThreadUserTime may return total time
Backport-of: 08c16c3
1 parent 7ce402d commit 9c620e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/java.management/share/classes/sun/management/ThreadImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -308,7 +308,7 @@ protected long[] getThreadUserTime(long[] ids) {
308308
long id = ids[0];
309309
Thread thread = Thread.currentThread();
310310
if (id == thread.threadId()) {
311-
times[0] = thread.isVirtual() ? -1L : getThreadTotalCpuTime0(0);
311+
times[0] = thread.isVirtual() ? -1L : getThreadUserCpuTime0(0);
312312
} else {
313313
times[0] = getThreadUserCpuTime0(id);
314314
}

0 commit comments

Comments
 (0)