summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2019-08-09 23:22:05 -0700
committerArnavion <arnavion@gmail.com>2019-08-09 23:22:05 -0700
commit9703a25d1b30a25aead4802fecd462dfac36e011 (patch)
treeb6ad5c0a065c4cae2af061d5645ff7029d9e2989
parent4b0600d8f8f1f6aaae6fc2e59e8697ff8779cf64 (diff)
Divide by 1000, not 1024, and show more decimals.
-rw-r--r--CPUMeter.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/CPUMeter.c b/CPUMeter.c
index 6f9419b5..f9984ffa 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -65,18 +65,18 @@ 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 (cpu != 0 && this->pl->settings->showCPUFrequency) {
- /* Initial frequency is in KHz. Divide it by 1024 till it's less than 1024, and emit unit accordingly */
+ /* Initial frequency is in KHz. Divide it by 1000 till it's less than 1000, and emit unit accordingly */
double cpuFrequency = this->values[CPU_METER_FREQUENCY];
char unit = 'K';
- if (cpuFrequency > 1024) {
- cpuFrequency /= 1024;
+ if (cpuFrequency > 1000) {
+ cpuFrequency /= 1000;
unit = 'M';
}
- if (cpuFrequency > 1024) {
- cpuFrequency /= 1024;
+ if (cpuFrequency > 1000) {
+ cpuFrequency /= 1000;
unit = 'G';
}
- xSnprintf(buffer, size, "%5.1f%% %.1f%cHz", percent, cpuFrequency, unit);
+ xSnprintf(buffer, size, "%5.1f%% %.3f%cHz", percent, cpuFrequency, unit);
} else {
xSnprintf(buffer, size, "%5.1f%%", percent);
}

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