summaryrefslogtreecommitdiffstats
path: root/freebsd/Platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/Platform.c')
-rw-r--r--freebsd/Platform.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
index a5e0e0b3..9e0c25b0 100644
--- a/freebsd/Platform.c
+++ b/freebsd/Platform.c
@@ -34,6 +34,10 @@ extern ProcessFieldData Process_fields[];
}*/
+#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 };
int Platform_numberOfFields = LAST_PROCESSFIELD;
@@ -171,7 +175,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
percent = v[0]+v[1]+v[2];
}
- percent = MIN(100.0, MAX(0.0, percent));
+ percent = CLAMP(percent, 0.0, 100.0);
if (isnan(percent)) percent = 0.0;
return percent;
}