add -h option to queuelat

Add -h (help) option to queuelat, which lists all
options.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
Marcelo Tosatti 2018-09-04 08:56:34 -03:00 committed by John Kacur
parent f3eb08bee5
commit f4ca6f6f2b
2 changed files with 17 additions and 1 deletions

View File

@ -51,6 +51,7 @@ cycles_per_packet: number of cycles to process one packet (int).
mpps(million-packet-per-sec): million packets per second (float).
tsc_freq_mhz: TSC frequency in MHz, as measured by TSC PIT calibration
(search for "Detected XXX MHz processor" in dmesg, and use the integer part).
timeout: timeout (in seconds).
How it works
============

View File

@ -532,6 +532,18 @@ int calculate_nr_packets_drain_per_block(void)
return nr_packets_drain_per_block;
}
void print_help(void)
{
printf("usage: queuelat [options]\n");
printf("-h show this help menu\n");
printf("-m max-queue-len (maximum latency allowed, in nanoseconds) (int)\n");
printf("-c cycles-per-packet (number of cycles to process one packet (int)\n");
printf("-p million-packet-per-sec (million packets per second) (float)\n");
printf("-f tsc-freq-mhz (TSC frequency in MHz) (float)\n");
printf("-t timeout (timeout, in seconds) (int)\n");
}
int main(int argc, char **argv)
{
double tsc_freq_mhz;
@ -549,7 +561,7 @@ int main(int argc, char **argv)
opterr = 0;
while ((c = getopt (argc, argv, "m:c:p:f:t:q:")) != -1)
while ((c = getopt (argc, argv, "m:c:p:f:t:q:h")) != -1)
switch (c)
{
case 'm':
@ -570,6 +582,9 @@ int main(int argc, char **argv)
case 'q':
qvalue = optarg;
break;
case 'h':
print_help();
return 0;
case '?':
if (optopt == 'm' || optopt == 'c' || optopt == 'p' ||
optopt == 'f' || optopt == 't' || optopt == 'q')