summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-20 21:40:51 +0200
committercgzones <cgzones@googlemail.com>2020-10-26 19:17:14 +0100
commitf757810f489b12d2a98dcb09751003f4ed002538 (patch)
tree4558520309803981d20d8c0aa6ab100211d9bd48
parent167adc0a2b4a940cae6c9eb71f3185b5d2d3b4fa (diff)
Improve handling of no data in Disk and Network IO Meters
-rw-r--r--CRT.c6
-rw-r--r--CRT.h1
-rw-r--r--DiskIOMeter.c21
-rw-r--r--NetworkIOMeter.c16
-rw-r--r--darwin/Platform.c8
-rw-r--r--darwin/Platform.h6
-rw-r--r--dragonflybsd/Platform.c8
-rw-r--r--dragonflybsd/Platform.h6
-rw-r--r--freebsd/Platform.c18
-rw-r--r--freebsd/Platform.h6
-rw-r--r--linux/Platform.c36
-rw-r--r--linux/Platform.h6
-rw-r--r--openbsd/Platform.c8
-rw-r--r--openbsd/Platform.h6
-rw-r--r--solaris/Platform.c8
-rw-r--r--solaris/Platform.h6
-rw-r--r--unsupported/Platform.c8
-rw-r--r--unsupported/Platform.h6
18 files changed, 119 insertions, 61 deletions
diff --git a/CRT.c b/CRT.c
index e6f2ec9e..888444cc 100644
--- a/CRT.c
+++ b/CRT.c
@@ -94,6 +94,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Cyan,Black),
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black),
+ [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
@@ -170,6 +171,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD,
[METER_TEXT] = A_NORMAL,
[METER_VALUE] = A_BOLD,
+ [METER_VALUE_ERROR] = A_BOLD,
[METER_VALUE_NOTICE] = A_BOLD,
[METER_VALUE_IOREAD] = A_NORMAL,
[METER_VALUE_IOWRITE] = A_NORMAL,
@@ -246,6 +248,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = ColorPair(Red,White),
[METER_TEXT] = ColorPair(Blue,White),
[METER_VALUE] = ColorPair(Black,White),
+ [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,White),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,White),
[METER_VALUE_IOREAD] = ColorPair(Green,White),
[METER_VALUE_IOWRITE] = ColorPair(Yellow,White),
@@ -322,6 +325,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Blue,Black),
[METER_VALUE] = ColorPair(Blue,Black),
+ [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Yellow,Black),
@@ -398,6 +402,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Blue),
[METER_TEXT] = ColorPair(Cyan,Blue),
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue),
+ [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Blue),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Blue),
[METER_VALUE_IOREAD] = ColorPair(Green,Blue),
[METER_VALUE_IOWRITE] = ColorPair(Black,Blue),
@@ -474,6 +479,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
[METER_TEXT] = ColorPair(Cyan,Black),
[METER_VALUE] = ColorPair(Green,Black),
+ [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
diff --git a/CRT.h b/CRT.h
index 606492a4..1cdc209c 100644
--- a/CRT.h
+++ b/CRT.h
@@ -52,6 +52,7 @@ typedef enum ColorElements_ {
LARGE_NUMBER,
METER_TEXT,
METER_VALUE,
+ METER_VALUE_ERROR,
METER_VALUE_NOTICE,
METER_VALUE_IOREAD,
METER_VALUE_IOWRITE,
diff --git a/DiskIOMeter.c b/DiskIOMeter.c
index 432ba6f0..9f311653 100644
--- a/DiskIOMeter.c
+++ b/DiskIOMeter.c
@@ -24,6 +24,7 @@ static const int DiskIOMeter_attributes[] = {
METER_VALUE_IOWRITE,
};
+static bool hasData = false;
static unsigned long int cached_read_diff = 0;
static unsigned long int cached_write_diff = 0;
static double cached_utilisation_diff = 0.0;
@@ -37,12 +38,20 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
struct timeval tv;
gettimeofday(&tv, NULL);
unsigned long long int timeInMilliSeconds = (unsigned long long int)tv.tv_sec * 1000 + (unsigned long long int)tv.tv_usec / 1000;
+ unsigned long long int passedTimeInMs = timeInMilliSeconds - cached_last_update;
/* update only every 500ms */
- if (timeInMilliSeconds - cached_last_update > 500) {
+ if (passedTimeInMs > 500) {
+ cached_last_update = timeInMilliSeconds;
+
unsigned long int bytesRead, bytesWrite, msTimeSpend;
- Platform_getDiskIO(&bytesRead, &bytesWrite, &msTimeSpend);
+ hasData = Platform_getDiskIO(&bytesRead, &bytesWrite, &msTimeSpend);
+ if (!hasData) {
+ this->values[0] = 0;
+ xSnprintf(buffer, len, "no data");
+ return;
+ }
cached_read_diff = (bytesRead - cached_read_total) / 1024; /* Meter_humanUnit() expects unit in kilo */
cached_read_total = bytesRead;
@@ -50,8 +59,7 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
cached_write_diff = (bytesWrite - cached_write_total) / 1024; /* Meter_humanUnit() expects unit in kilo */
cached_write_total = bytesWrite;
- cached_utilisation_diff = 100 * (double)(msTimeSpend - cached_msTimeSpend_total) / (timeInMilliSeconds - cached_last_update);
- cached_last_update = timeInMilliSeconds;
+ cached_utilisation_diff = 100 * (double)(msTimeSpend - cached_msTimeSpend_total) / passedTimeInMs;
cached_msTimeSpend_total = msTimeSpend;
}
@@ -65,6 +73,11 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
}
static void DIskIOMeter_display(ATTR_UNUSED const Object* cast, RichString* out) {
+ if (!hasData) {
+ RichString_write(out, CRT_colors[METER_VALUE_ERROR], "no data");
+ return;
+ }
+
char buffer[16];
int color = cached_utilisation_diff > 40.0 ? METER_VALUE_NOTICE : METER_VALUE;
diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c
index 44792c15..51d8d5ca 100644
--- a/NetworkIOMeter.c
+++ b/NetworkIOMeter.c
@@ -16,6 +16,7 @@ static const int NetworkIOMeter_attributes[] = {
METER_VALUE_IOWRITE,
};
+static bool hasData = false;
static unsigned long int cached_rxb_diff = 0;
static unsigned long int cached_rxp_diff = 0;
static unsigned long int cached_txb_diff = 0;
@@ -35,9 +36,15 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, i
/* update only every 500ms */
if (passedTimeInMs > 500) {
+ cached_last_update = timeInMilliSeconds;
+
unsigned long int bytesReceived, packetsReceived, bytesTransmitted, packetsTransmitted;
- Platform_getNetworkIO(&bytesReceived, &packetsReceived, &bytesTransmitted, &packetsTransmitted);
+ hasData = Platform_getNetworkIO(&bytesReceived, &packetsReceived, &bytesTransmitted, &packetsTransmitted);
+ if (!hasData) {
+ xSnprintf(buffer, len, "no data");
+ return;
+ }
cached_rxb_diff = (bytesReceived - cached_rxb_total) / 1024; /* Meter_humanUnit() expects unit in kilo */
cached_rxb_diff = 1000.0 * cached_rxb_diff / passedTimeInMs; /* convert to per second */
@@ -52,8 +59,6 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, i
cached_txp_diff = packetsTransmitted - cached_txp_total;
cached_txp_total = packetsTransmitted;
-
- cached_last_update = timeInMilliSeconds;
}
char bufferBytesReceived[12], bufferBytesTransmitted[12];
@@ -63,6 +68,11 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, i
}
static void NetworkIOMeter_display(ATTR_UNUSED const Object* cast, RichString* out) {
+ if (!hasData) {
+ RichString_write(out, CRT_colors[METER_VALUE_ERROR], "no data");
+ return;
+ }
+
char buffer[64];
RichString_write(out, CRT_colors[METER_TEXT], "rx: ");
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 26bcbad2..1a8b8002 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -311,12 +311,15 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
// TODO
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -325,4 +328,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = 0;
*bytesTransmitted = 0;
*packetsTransmitted = 0;
+ return false;
}
diff --git a/darwin/Platform.h b/darwin/Platform.h
index d953b51c..bdfe226d 100644
--- a/darwin/Platform.h
+++ b/darwin/Platform.h
@@ -48,9 +48,11 @@ void Platform_setZfsCompressedArcValues(Meter* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c
index b67ff8a1..f01749b7 100644
--- a/dragonflybsd/Platform.c
+++ b/dragonflybsd/Platform.c
@@ -206,12 +206,15 @@ char* Platform_getProcessEnv(pid_t pid) {
return NULL;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
// TODO
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -220,4 +223,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = 0;
*bytesTransmitted = 0;
*packetsTransmitted = 0;
+ return false;
}
diff --git a/dragonflybsd/Platform.h b/dragonflybsd/Platform.h
index 7f31f0a5..7ea211ca 100644
--- a/dragonflybsd/Platform.h
+++ b/dragonflybsd/Platform.h
@@ -40,9 +40,11 @@ void Platform_setSwapValues(Meter* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
index b03c58be..465781a8 100644
--- a/freebsd/Platform.c
+++ b/freebsd/Platform.c
@@ -241,12 +241,15 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
// TODO
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -258,13 +261,9 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
const int countMib[] = { CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_SYSTEM, IFMIB_IFCOUNT };
r = sysctl(countMib, ARRAYSIZE(countMib), &count, &countLen, NULL, 0);
- if (r < 0) {
- *bytesReceived = 0;
- *packetsReceived = 0;
- *bytesTransmitted = 0;
- *packetsTransmitted = 0;
- return;
- }
+ if (r < 0)
+ return false;
+
unsigned long int bytesReceivedSum = 0, packetsReceivedSum = 0, bytesTransmittedSum = 0, packetsTransmittedSum = 0;
@@ -291,4 +290,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = packetsReceivedSum;
*bytesTransmitted = bytesTransmittedSum;
*packetsTransmitted = packetsTransmittedSum;
+ return true;
}
diff --git a/freebsd/Platform.h b/freebsd/Platform.h
index c5cf659f..40fb2d97 100644
--- a/freebsd/Platform.h
+++ b/freebsd/Platform.h
@@ -43,9 +43,11 @@ void Platform_setZfsCompressedArcValues(Meter* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/linux/Platform.c b/linux/Platform.c
index e6c1c08c..d21de018 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -302,14 +302,11 @@ void Platform_getPressureStall(const char *file, bool some, double* ten, double*
fclose(fd);
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
FILE *fd = fopen(PROCDIR "/diskstats", "r");
- if (!fd) {
- *bytesRead = 0;
- *bytesWrite = 0;
- *msTimeSpend = 0;
- return;
- }
+ if (!fd)
+ return false;
+
unsigned long int read_sum = 0, write_sum = 0, timeSpend_sum = 0;
char lineBuffer[256];
while (fgets(lineBuffer, sizeof(lineBuffer), fd)) {
@@ -347,32 +344,28 @@ void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWr
*bytesRead = 512 * read_sum;
*bytesWrite = 512 * write_sum;
*msTimeSpend = timeSpend_sum;
+ return true;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
FILE *fd = fopen(PROCDIR "/net/dev", "r");
- if (!fd) {
- *bytesReceived = 0;
- *packetsReceived = 0;
- *bytesTransmitted = 0;
- *packetsTransmitted = 0;
- return;
- }
+ if (!fd)
+ return false;
unsigned long int bytesReceivedSum = 0, packetsReceivedSum = 0, bytesTransmittedSum = 0, packetsTransmittedSum = 0;
char lineBuffer[512];
while (fgets(lineBuffer, sizeof(lineBuffer), fd)) {
char interfaceName[32];
unsigned long int bytesReceivedParsed, packetsReceivedParsed, bytesTransmittedParsed, packetsTransmittedParsed;
- if (fscanf(fd, "%31s %lu %lu %*u %*u %*u %*u %*u %*u %lu %lu %*u %*u %*u %*u %*u %*u",
- interfaceName,
- &bytesReceivedParsed,
- &packetsReceivedParsed,
- &bytesTransmittedParsed,
- &packetsTransmittedParsed) != 5)
+ if (sscanf(lineBuffer, "%31s %lu %lu %*u %*u %*u %*u %*u %*u %lu %lu",
+ interfaceName,
+ &bytesReceivedParsed,
+ &packetsReceivedParsed,
+ &bytesTransmittedParsed,
+ &packetsTransmittedParsed) != 5)
continue;
if (String_eq(interfaceName, "lo:"))
@@ -390,4 +383,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = packetsReceivedSum;
*bytesTransmitted = bytesTransmittedSum;
*packetsTransmitted = packetsTransmittedSum;
+ return true;
}
diff --git a/linux/Platform.h b/linux/Platform.h
index 3d4cabac..3c3986e6 100644
--- a/linux/Platform.h
+++ b/linux/Platform.h
@@ -46,9 +46,11 @@ char* Platform_getProcessEnv(pid_t pid);
void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index 5b249268..eac13c96 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -288,12 +288,15 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
// TODO
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -302,4 +305,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = 0;
*bytesTransmitted = 0;
*packetsTransmitted = 0;
+ return false;
}
diff --git a/openbsd/Platform.h b/openbsd/Platform.h
index f97fdc84..b75d87b2 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -41,9 +41,11 @@ void Platform_setSwapValues(Meter* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/solaris/Platform.c b/solaris/Platform.c
index 4203a964..978cca08 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -264,12 +264,15 @@ char* Platform_getProcessEnv(pid_t pid) {
return envBuilder.env;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
// TODO
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -278,4 +281,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = 0;
*bytesTransmitted = 0;
*packetsTransmitted = 0;
+ return false;
}
diff --git a/solaris/Platform.h b/solaris/Platform.h
index 130c70cd..f95515c6 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -63,9 +63,11 @@ void Platform_setZfsCompressedArcValues(Meter* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);
diff --git a/unsupported/Platform.c b/unsupported/Platform.c
index cc28fd8f..e2d7fa6b 100644
--- a/unsupported/Platform.c
+++ b/unsupported/Platform.c
@@ -141,11 +141,14 @@ char* Platform_getProcessEnv(pid_t pid) {
return NULL;
}
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend) {
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend) {
*bytesRead = *bytesWrite = *msTimeSpend = 0;
+ return false;
}
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted) {
@@ -153,4 +156,5 @@ void Platform_getNetworkIO(unsigned long int *bytesReceived,
*packetsReceived = 0;
*bytesTransmitted = 0;
*packetsTransmitted = 0;
+ return false;
}
diff --git a/unsupported/Platform.h b/unsupported/Platform.h
index 1049919d..1558d66a 100644
--- a/unsupported/Platform.h
+++ b/unsupported/Platform.h
@@ -47,9 +47,11 @@ bool Process_isThread(const Process* this);
char* Platform_getProcessEnv(pid_t pid);
-void Platform_getDiskIO(unsigned long int *bytesRead, unsigned long int *bytesWrite, unsigned long int *msTimeSpend);
+bool Platform_getDiskIO(unsigned long int *bytesRead,
+ unsigned long int *bytesWrite,
+ unsigned long int *msTimeSpend);
-void Platform_getNetworkIO(unsigned long int *bytesReceived,
+bool Platform_getNetworkIO(unsigned long int *bytesReceived,
unsigned long int *packetsReceived,
unsigned long int *bytesTransmitted,
unsigned long int *packetsTransmitted);

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