Skip to content

Commit

Permalink
8347267: [macOS]: UnixOperatingSystem.c:67:40: runtime error: divisio…
Browse files Browse the repository at this point in the history
…n by zero

Backport-of: 5e92a4c
  • Loading branch information
MBaesken committed Feb 19, 2025
1 parent c9bf948 commit 6cc0ec2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -63,6 +63,9 @@ Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0

jlong used_delta = used - last_used;
jlong total_delta = total - last_total;
if (total_delta == 0) {
return 0;
}

jdouble cpu = (jdouble) used_delta / total_delta;

Expand Down

0 comments on commit 6cc0ec2

Please sign in to comment.