summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
diff options
context:
space:
mode:
authorRedha Gouicem <redha.gouicem@gmail.com>2020-08-28 12:15:32 +0200
committerRedha Gouicem <redha.gouicem@gmail.com>2020-08-28 12:15:32 +0200
commit3ef5df25bc7178d49a4e18eb6b62f48811187def (patch)
tree8ef10bc07fa7f156efc7085a6f0bc352e8b2a663 /CPUMeter.c
parent2d14269bcd9c2db190aff60ac5a120c5b7ebad92 (diff)
always display frequency in MHz
Diffstat (limited to 'CPUMeter.c')
-rw-r--r--CPUMeter.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 6131a09d..e09769cc 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -65,18 +65,13 @@ 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), "%.0f%cHz", cpuFrequency, unit);
}
if (this->pl->settings->showCPUUsage) {
xSnprintf(buffer, size, "%5.1f%% %s", percent, cpuFrequencyBuffer);

© 2014-2024 Faster IT GmbH | imprint | privacy policy