summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-13 15:01:39 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-13 15:01:39 +0200
commitaa435eec4cfd1794438ea8593fff0181c70dcebf (patch)
treef677f181217c99d587a0f87448f7f2771f5234be
parent22ed65468335a3d803b74db2d4ee39344a4543cc (diff)
ifpps: warn when 1Gbit/s and interval < 1sec
It is possible to use a interval even of 0, although it would not really make sense. It's not a bug either, so throw a warning to the user in that case on 1Gbit/s. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--ifpps.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ifpps.c b/ifpps.c
index 05e3459..ec0d55b 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -1022,6 +1022,7 @@ static void screen_update(WINDOW *screen, const char *ifname, const struct ifsta
bool need_info)
{
int cpus, top, voff = 1, cvoff = 2;
+ u32 rate = device_bitrate(ifname);
curs_set(0);
@@ -1068,7 +1069,8 @@ static void screen_update(WINDOW *screen, const char *ifname, const struct ifsta
} else {
if (need_info)
mvwprintw(screen, cvoff, 2, "(consider to increase "
- "your sampling interval, e.g. -t 10000)");
+ "your sampling interval, e.g. -t %d)",
+ rate > SPEED_1000 ? 10000 : 1000);
else
mvwprintw(screen, cvoff, 2, " "
" ");
@@ -1087,7 +1089,9 @@ static int screen_main(const char *ifname, uint64_t ms_interval,
stats_screen = screen_init(true);
- if (rate > SPEED_1000 && ms_interval <= 1000 && !suppress_warnings)
+ if (((rate > SPEED_1000 && ms_interval <= 1000) ||
+ (rate = SPEED_1000 && ms_interval < 1000)) &&
+ !suppress_warnings)
need_info = true;
while (!sigint) {