diff options
author | joeyh <joeyh> | 2006-12-23 20:58:47 +0000 |
---|---|---|
committer | joeyh <joeyh> | 2006-12-23 20:58:47 +0000 |
commit | b6547b684543ce4dca051366714065d6482e7bd5 (patch) | |
tree | ec579d5edec08351891f7dd75141ca4c74c72afd | |
parent | 7b0da07eeeb8007494f92391b03f5128ed3e5cd7 (diff) | |
download | moreutils-0.20.tar.gz |
releasing version 0.200.20
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | ifdata.c | 20 | ||||
-rw-r--r-- | ifdata.docbook | 16 |
3 files changed, 39 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index 712cb0e..c245223 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ -moreutils (0.20) UNRELEASED; urgency=low +moreutils (0.20) unstable; urgency=low * Typo fixes from Ralf Wildenhues. + * ifdata: Add -bips and -bops options contributed by André Appel, + to print the number of bytes of incoming/outgoing traffic per second. - -- Joey Hess <joeyh@debian.org> Sun, 26 Nov 2006 14:48:57 -0500 + -- Joey Hess <joeyh@debian.org> Sat, 23 Dec 2006 15:55:45 -0500 moreutils (0.19) unstable; urgency=low @@ -42,6 +42,8 @@ enum { DO_SOUTMULTICAST, DO_PNETWORK, DO_PHWADDRESS, + DO_BIPS, + DO_BOPS }; struct if_stat { @@ -309,6 +311,8 @@ const struct { { "-sox", DO_SOUTCOLLS, 1, "Print # of out collisions" }, { "-soc", DO_SOUTCARRIER, 1, "Print # of out carrier loss" }, { "-som", DO_SOUTMULTICAST, 1, "Print # of out multicast" }, + { "-bips",DO_BIPS, 1, "Print # of incoming bytes per second" }, + { "-bops",DO_BOPS, 1, "Print # of outgoing bytes per second" }, }; void usage(const char *name) { @@ -335,7 +339,7 @@ static void print_addr(struct sockaddr *sadr) { print_quad(sadr); } -struct if_stat *ifstats; +struct if_stat *ifstats, *ifstats2 = NULL; void please_do(int ndo, int *todo, const char *ifname) { int i; @@ -435,6 +439,20 @@ void please_do(int ndo, int *todo, const char *ifname) { case DO_SOUTMULTICAST: printf("%llu",ifstats->out_multicast); break; + case DO_BIPS: + if (ifstats2 == NULL) { + sleep(1); + ifstats2 = get_stats(ifname); + } + printf("%llu", ifstats2->in_bytes-ifstats->in_bytes); + break; + case DO_BOPS: + if (ifstats2 == NULL) { + sleep(1); + ifstats2 = get_stats(ifname); + } + printf("%llu", ifstats2->out_bytes-ifstats->out_bytes); + break; case DO_SOUTALL: printf("%llu %llu %llu %llu %llu %llu %llu %llu", ifstats->out_bytes, ifstats->out_packets, diff --git a/ifdata.docbook b/ifdata.docbook index 60ce90d..5f2837f 100644 --- a/ifdata.docbook +++ b/ifdata.docbook @@ -285,6 +285,22 @@ with this program; if not, write to the Free Software Foundation, Inc., packets.</para> </listitem> </varlistentry> + + <varlistentry> + <term><option>-bips</option></term> + <listitem> + <para>Prints the number of bytes of + incoming traffic measured in one second.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-bops</option></term> + <listitem> + <para>Prints the number of bytes of + outgoing traffic measured in one second.</para> + </listitem> + </varlistentry> </variablelist> </refsect1> |