< prev index next >

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

Print this page
o  rev 57733 : 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
|  Reviewed-by: bobv, mchung
~


 154                             double cpuLoad = getSingleCpuLoad0(cpu);
 155                             if (cpuLoad < 0) {
 156                                 return -1;
 157                             }
 158                             systemLoad += cpuLoad;
 159                         }
 160                         return systemLoad / cpuSet.length;
 161                     }
 162                     return -1;
 163                 }
 164             }
 165         }
 166         return getCpuLoad0();
 167     }
 168 
 169     public double getProcessCpuLoad() {
 170         return getProcessCpuLoad0();
 171     }
 172 
 173     private boolean isCpuSetSameAsHostCpuSet() {
 174         if (containerMetrics != null) {
 175             return containerMetrics.getCpuSetCpus().length == getHostConfiguredCpuCount0();
 176         }
 177         return false;
 178     }
 179 
 180     /* native methods */
 181     private native long getCommittedVirtualMemorySize0();
 182     private native long getFreeMemorySize0();
 183     private native long getFreeSwapSpaceSize0();
 184     private native long getMaxFileDescriptorCount0();
 185     private native long getOpenFileDescriptorCount0();
 186     private native long getProcessCpuTime0();
 187     private native double getProcessCpuLoad0();
 188     private native double getCpuLoad0();
 189     private native long getTotalMemorySize0();
 190     private native long getTotalSwapSpaceSize0();
 191     private native double getSingleCpuLoad0(int cpuNum);
 192     private native int getHostConfiguredCpuCount0();
 193 
 194     static {


 154                             double cpuLoad = getSingleCpuLoad0(cpu);
 155                             if (cpuLoad < 0) {
 156                                 return -1;
 157                             }
 158                             systemLoad += cpuLoad;
 159                         }
 160                         return systemLoad / cpuSet.length;
 161                     }
 162                     return -1;
 163                 }
 164             }
 165         }
 166         return getCpuLoad0();
 167     }
 168 
 169     public double getProcessCpuLoad() {
 170         return getProcessCpuLoad0();
 171     }
 172 
 173     private boolean isCpuSetSameAsHostCpuSet() {
 174         if (containerMetrics != null && containerMetrics.getCpuSetCpus() != null) {
 175             return containerMetrics.getCpuSetCpus().length == getHostConfiguredCpuCount0();
 176         }
 177         return false;
 178     }
 179 
 180     /* native methods */
 181     private native long getCommittedVirtualMemorySize0();
 182     private native long getFreeMemorySize0();
 183     private native long getFreeSwapSpaceSize0();
 184     private native long getMaxFileDescriptorCount0();
 185     private native long getOpenFileDescriptorCount0();
 186     private native long getProcessCpuTime0();
 187     private native double getProcessCpuLoad0();
 188     private native double getCpuLoad0();
 189     private native long getTotalMemorySize0();
 190     private native long getTotalSwapSpaceSize0();
 191     private native double getSingleCpuLoad0(int cpuNum);
 192     private native int getHostConfiguredCpuCount0();
 193 
 194     static {
< prev index next >