summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcess.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-09-07 11:53:58 +0200
committercgzones <cgzones@googlemail.com>2020-09-24 18:06:36 +0200
commit29ec1151436bd539dc659a394622cdd2d672f975 (patch)
tree6c53a7c5ffe9e8dfd77d451d174c20ff4b1e0c41 /linux/LinuxProcess.c
parent47e2cefe02dffe00369e5630eb1e3f54174f20af (diff)
Update IO rate display to use NAN on error
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r--linux/LinuxProcess.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 9dd3b93d..ccdb9da8 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -17,6 +17,7 @@ in the source distribution for its full text.
#include <string.h>
#include <sys/syscall.h>
#include <time.h>
+#include <math.h>
/* semi-global */
long long btime;
@@ -237,9 +238,15 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
case IO_READ_RATE: Process_outputRate(str, buffer, n, lp->io_rate_read_bps, coloring); return;
case IO_WRITE_RATE: Process_outputRate(str, buffer, n, lp->io_rate_write_bps, coloring); return;
case IO_RATE: {
- double totalRate = (lp->io_rate_read_bps != -1)
- ? (lp->io_rate_read_bps + lp->io_rate_write_bps)
- : -1;
+ double totalRate = NAN;
+ if(!isnan(lp->io_rate_read_bps) && !isnan(lp->io_rate_write_bps))
+ totalRate = lp->io_rate_read_bps + lp->io_rate_write_bps;
+ else if(!isnan(lp->io_rate_read_bps))
+ totalRate = lp->io_rate_read_bps;
+ else if(!isnan(lp->io_rate_write_bps))
+ totalRate = lp->io_rate_write_bps;
+ else
+ totalRate = NAN;
Process_outputRate(str, buffer, n, totalRate, coloring); return;
}
#endif

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