summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@src.gnome.org>1998-11-22 19:40:11 +0000
committerMartin Baulig <martin@src.gnome.org>1998-11-22 19:40:11 +0000
commit50f5f4c001e47e19342157d1a517fd3cbf84b8ac (patch)
tree43f9812e62f932be46d974c6a5c50973163c507e
parent1db20e75ec7ded9447fc7423005fe9003373dd1d (diff)
When using LibGTop to read the data, first try to get byte counts -netload_libgtop
if this fails, use packet counts.
-rw-r--r--netload/linux-proc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/netload/linux-proc.c b/netload/linux-proc.c
index 4a0dc34b2..e2bab70fb 100644
--- a/netload/linux-proc.c
+++ b/netload/linux-proc.c
@@ -26,7 +26,7 @@
#define REQUIRED_NETLOAD_FLAGS (1 << GLIBTOP_NETLOAD_BYTES_TOTAL)
-#endif /* NETLOAD_LIBGTOP */
+#else /* not NETLOAD_LIBGTOP */
static char *skip_token(const char *p)
{
@@ -78,6 +78,8 @@ Device_Info *ReadProc()
return retval;
}
+#endif
+
/*
* Return the byte count for a single device. Cache the result from reading the /proc file.
* refresh = 1 means reload the /proc file.
@@ -89,7 +91,11 @@ GetTraffic(int refresh, char *device)
glibtop_netload netload;
glibtop_get_netload (&netload, device);
- return netload.bytes_total;
+
+ if (netload.flags & REQUIRED_NETLOAD_FLAGS)
+ return netload.bytes_total;
+ else
+ return netload.packets_total;
#else
static Device_Info *di = NULL;
Device_Info *d;