mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-27 10:40:29 +00:00
8347267: [macOS]: UnixOperatingSystem.c:67:40: runtime error: division by zero
Reviewed-by: kevinw, cjplummer
This commit is contained in:
parent
55c6904e8f
commit
5e92a4ceaf
@ -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
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user