You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9872bfd
Browse filesBrowse the repository at this point in the historyBrowse files
kvm: use the base CPU frequency as the host speed and expose the maximum frequency as a host detail (#14383)
* kvm: use the base CPU frequency as the host speed and expose the maximum frequency as a host detail
* Remove turbo from UI label
* Change how the maximum frequency is displayed in the UI
* Apply suggestion from @sureshanaparti
---------
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
* @return the maximum frequency of the CPU, in MHz, which may include the turbo frequency; or 0 if it could not be retrieved. This value is only
97
+
* informative; {@link #getCpuSpeed()} is the one used to calculate the capacity of the host.
98
+
*/
99
+
publiclonggetCpuMaxSpeed() {
100
+
returnthis.cpuMaxSpeed;
101
+
}
102
+
93
103
publiclonggetTotalMemory() {
94
104
returnthis.totalMemory;
95
105
}
@@ -136,25 +146,30 @@ protected static long getCpuSpeed(final String cpabilities, final NodeInfo nodeI
136
146
returnspeed;
137
147
}
138
148
139
-
privatestaticlonggetCpuSpeedFromCommandLscpu() {
149
+
/**
150
+
* Retrieves the CPU speed, in MHz, from the "lscpu" command. The base frequency advertised in the model name is preferred because the CPU speed is used to
151
+
* calculate the capacity of the host and the CPU quota of the VMs with CPU cap enabled; thus, it must be a frequency that the CPU is able to sustain.
152
+
* "CPU max MHz" may include the turbo frequency; therefore, it is only used when the model name does not advertise a frequency.
LOGGER.debug(String.format("Unable to retrieve the CPU max speed from lscpu; command [%s] resulted in the value [%s].", LSCPU_CPU_MAX_MHZ_COMMAND, result));
187
+
return0L;
188
+
}
189
+
}
190
+
166
191
privatestaticlonggetCpuSpeedFromFile() {
167
192
for (finalStringcpuInfoFreqFileName: cpuInfoFreqFileNames) {
168
193
LOGGER.info(String.format("Fetching CPU speed from file [%s].", cpuInfoFreqFileName));
0 commit comments