aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDietmar Spingler <d_spingler@gmx.de>2016-12-31 17:00:28 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-31 17:02:27 -0200
commit951c4878a93f4722146f8bc6515a47fba6470bb3 (patch)
treed5a264b18e7f09eccfef234281bba57134ee2672
parentd5d1e38a2f281f518956671988c0900feeb9c549 (diff)
dvb-fe-tool: add an option to set maximum number of stat samples
Just like "ping", add a counter for the maximum number of statistics samples. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--utils/dvb/dvb-fe-tool.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/dvb/dvb-fe-tool.c b/utils/dvb/dvb-fe-tool.c
index ad797c4d..20dea20a 100644
--- a/utils/dvb/dvb-fe-tool.c
+++ b/utils/dvb/dvb-fe-tool.c
@@ -66,6 +66,7 @@ static const struct argp_option options[] = {
{"server", 'H', N_("SERVER"), 0, N_("dvbv5-daemon host IP address"), 0},
{"tcp-port", 'T', N_("PORT"), 0, N_("dvbv5-daemon host tcp port"), 0},
{"device-mon", 'D', 0, 0, N_("monitors device insert/removal"), 0},
+ {"count", 'c', N_("COUNT"), 0, N_("samples to take (default 0 = infinite)"), 0},
{"help", '?', 0, 0, N_("Give this help list"), -1},
{"usage", -3, 0, 0, N_("Give a short usage message")},
{"version", 'V', 0, 0, N_("Print program version"), -1},
@@ -84,6 +85,7 @@ static int femon = 0;
static int acoustical = 0;
static int timeout_flag = 0;
static int device_mon = 0;
+static int count = 0;
static void do_timeout(int x)
{
@@ -148,6 +150,9 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state)
case 'v':
verbose ++;
break;
+ case 'c':
+ count = atoi(arg);
+ break;
case '?':
argp_state_help(state, state->out_stream,
ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG
@@ -280,6 +285,8 @@ static void get_show_stats(struct dvb_v5_fe_parms *parms)
rc = dvb_fe_get_stats(parms);
if (!rc)
print_frontend_stats(stderr, parms);
+ if (count > 0 && !--count)
+ break;
if (!timeout_flag)
usleep(1000000);
} while (!timeout_flag);

Privacy Policy