Skip to content

Commit 08736f4

Browse files
author
duke
committed
Backport 5e92a4ceafd0626e3600e44a3370ca2f5d9347c8
1 parent f90566a commit 08736f4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/jdk.management/macosx/native/libmanagement_ext/UnixOperatingSystem.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 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
@@ -63,6 +63,9 @@ Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0
6363

6464
jlong used_delta = used - last_used;
6565
jlong total_delta = total - last_total;
66+
if (total_delta == 0) {
67+
return 0;
68+
}
6669

6770
jdouble cpu = (jdouble) used_delta / total_delta;
6871

0 commit comments

Comments
 (0)