mirror of https://github.com/xzeldon/htop.git
Merge branch 'rgouicem-master'
This commit is contained in:
commit
06ba81beec
|
@ -40,18 +40,12 @@ static void CPUMeter_updateValues(Meter* this, char* buffer, int size) {
|
|||
memset(this->values, 0, sizeof(double) * CPU_METER_ITEMCOUNT);
|
||||
double percent = Platform_setCPUValues(this, cpu);
|
||||
if (this->pl->settings->showCPUFrequency) {
|
||||
/* Initial frequency is in MHz. Emit it as GHz if it's larger than 1000MHz */
|
||||
double cpuFrequency = this->values[CPU_METER_FREQUENCY];
|
||||
char unit = 'M';
|
||||
char cpuFrequencyBuffer[16];
|
||||
if (cpuFrequency < 0) {
|
||||
xSnprintf(cpuFrequencyBuffer, sizeof(cpuFrequencyBuffer), "N/A");
|
||||
} else {
|
||||
if (cpuFrequency > 1000) {
|
||||
cpuFrequency /= 1000;
|
||||
unit = 'G';
|
||||
}
|
||||
xSnprintf(cpuFrequencyBuffer, sizeof(cpuFrequencyBuffer), "%.3f%cHz", cpuFrequency, unit);
|
||||
xSnprintf(cpuFrequencyBuffer, sizeof(cpuFrequencyBuffer), "%.0fMHz", cpuFrequency);
|
||||
}
|
||||
if (this->pl->settings->showCPUUsage) {
|
||||
xSnprintf(buffer, size, "%5.1f%% %s", percent, cpuFrequencyBuffer);
|
||||
|
|
Loading…
Reference in New Issue