From 909bb86f05c20f0ec6f5d55994065a293932ce21 Mon Sep 17 00:00:00 2001 From: Arnavion Date: Sat, 10 Aug 2019 17:17:45 -0700 Subject: Show N/A on unsupported platforms instead of 0KHz --- darwin/Platform.c | 2 ++ dragonflybsd/Platform.c | 3 +++ freebsd/Platform.c | 3 +++ openbsd/Platform.c | 2 ++ solaris/Platform.c | 3 +++ unsupported/Platform.c | 5 ++++- 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/darwin/Platform.c b/darwin/Platform.c index 1dce8b67..cd45bedf 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -217,6 +217,8 @@ double Platform_setCPUValues(Meter* mtr, int cpu) { /* Convert to percent and return */ total = mtr->values[CPU_METER_NICE] + mtr->values[CPU_METER_NORMAL] + mtr->values[CPU_METER_KERNEL]; + mtr->values[CPU_METER_FREQUENCY] = -1; + return CLAMP(total, 0.0, 100.0); } diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 370943d7..250e50e7 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -179,6 +179,9 @@ double Platform_setCPUValues(Meter* this, int cpu) { percent = CLAMP(percent, 0.0, 100.0); if (isnan(percent)) percent = 0.0; + + v[CPU_METER_FREQUENCY] = -1; + return percent; } diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 5dd6ca41..16d02329 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -178,6 +178,9 @@ double Platform_setCPUValues(Meter* this, int cpu) { percent = CLAMP(percent, 0.0, 100.0); if (isnan(percent)) percent = 0.0; + + v[CPU_METER_FREQUENCY] = -1; + return percent; } diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 4bb2e35e..e5a67d9f 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -233,6 +233,8 @@ double Platform_setCPUValues(Meter* this, int cpu) { perc = v[0] + v[1] + v[2] + v[3]; + v[CPU_METER_FREQUENCY] = -1; + if (perc <= 100. && perc >= 0.) { return perc; } else { diff --git a/solaris/Platform.c b/solaris/Platform.c index a29fcb47..c180d988 100644 --- a/solaris/Platform.c +++ b/solaris/Platform.c @@ -203,6 +203,9 @@ double Platform_setCPUValues(Meter* this, int cpu) { percent = CLAMP(percent, 0.0, 100.0); if (isnan(percent)) percent = 0.0; + + v[CPU_METER_FREQUENCY] = -1; + return percent; } diff --git a/unsupported/Platform.c b/unsupported/Platform.c index ba844191..b5e50c3f 100644 --- a/unsupported/Platform.c +++ b/unsupported/Platform.c @@ -108,8 +108,11 @@ int Platform_getMaxPid() { } double Platform_setCPUValues(Meter* this, int cpu) { - (void) this; (void) cpu; + + double* v = this->values; + v[CPU_METER_FREQUENCY] = -1; + return 0.0; } -- cgit v1.2.3