From c2e6ac191eb0a721570bf4bcb747c08f6487c7aa Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 30 May 2013 16:34:56 +0200 Subject: ifpps: Allow to select number of top hitter CPUs by command line option Instead of hard-coding the maximum number of top hitter CPUs, allow the user to set it manually using a command line option. The default value (if no command line parameter is specified) remains at 10. Also update the manpage accordingly. Signed-off-by: Tobias Klauser --- ifpps.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'ifpps.c') diff --git a/ifpps.c b/ifpps.c index 8d4a079..80ec3eb 100644 --- a/ifpps.c +++ b/ifpps.c @@ -23,9 +23,6 @@ #include "xio.h" #include "built_in.h" -/* Number of top hitter CPUs to display */ -#define TOP_CPUS 10 - struct wifi_stat { uint32_t bitrate; int16_t link_qual, link_qual_max; @@ -64,10 +61,11 @@ static int stats_loop = 0; static WINDOW *stats_screen = NULL; -static const char *short_options = "d:t:vhclp"; +static const char *short_options = "d:t:n:vhclp"; static const struct option long_options[] = { {"dev", required_argument, NULL, 'd'}, {"interval", required_argument, NULL, 't'}, + {"num-cpus", required_argument, NULL, 'n'}, {"promisc", no_argument, NULL, 'p'}, {"csv", no_argument, NULL, 'c'}, {"loop", no_argument, NULL, 'l'}, @@ -102,6 +100,8 @@ static void __noreturn help(void) "Options:\n" " -d|--dev Device to fetch statistics for e.g., eth0\n" " -t|--interval