Skip to content

Commit f39c65a

Browse files
author
duke
committedMar 30, 2022
Automatic merge of jdk:master into master
2 parents 80799a6 + a625bfd commit f39c65a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/jdk.management/unix/classes/com/sun/management/internal/OperatingSystemImpl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, 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
@@ -93,7 +93,8 @@ public double getContainerCpuLoad() {
9393
int totalCPUs = getHostOnlineCpuCount0();
9494
int containerCPUs = getAvailableProcessors();
9595
// scale the total host load to the actual container cpus
96-
hostTicks = hostTicks * containerCPUs / totalCPUs;
96+
double scaleFactor = ((double) containerCPUs) / totalCPUs;
97+
hostTicks = (long) (hostTicks * scaleFactor);
9798
return getUsageDividesTotal(cpuUsageSupplier().getAsLong(), hostTicks);
9899
} else {
99100
// If CPU quotas and shares are not active then find the average load for

0 commit comments

Comments
 (0)
Please sign in to comment.