summaryrefslogtreecommitdiffstats
path: root/darwin/Platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'darwin/Platform.c')
-rw-r--r--darwin/Platform.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 80899064..22a18774 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -27,6 +27,10 @@ in the source distribution for its full text.
#include "DarwinProcess.h"
}*/
+#ifndef CLAMP
+#define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x)))
+#endif
+
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
SignalItem Platform_signals[] = {
@@ -213,7 +217,7 @@ 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];
- return MIN(100.0, MAX(0.0, total));
+ return CLAMP(total, 0.0, 100.0);
}
void Platform_setMemoryValues(Meter* mtr) {