From: John Kacur <jkacur@redhat.com>
To: RT <linux-rt-users@vger.kernel.org>
Cc: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: [PATCH 8/9] rt-tests: queuelat: Fixes to man page and display_help
Date: Thu, 23 Jan 2020 21:50:28 +0100 [thread overview]
Message-ID: <20200123205029.20176-9-jkacur@redhat.com> (raw)
In-Reply-To: <20200123205029.20176-1-jkacur@redhat.com>
- Make sure that help is displayed and not just the message
"Unknown option" when the options are incorrect.
- Add -q to the man page and to the print_help()
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/queuelat/queuelat.8 | 4 +++-
src/queuelat/queuelat.c | 22 +++++++++++++---------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/queuelat/queuelat.8 b/src/queuelat/queuelat.8
index d68beb98bff7..f67a0bb7556e 100644
--- a/src/queuelat/queuelat.8
+++ b/src/queuelat/queuelat.8
@@ -52,7 +52,9 @@ TSC frequency in MHz.
.TP
.B \-t timeout
Timeout in seconds to quit the program.
-
+.TP
+.B \-q min_queue_len_to_print_trace
+Minimum queue length to print in the trace
.SH AUTHOR
queuelat was written by Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index 98346f346f82..7e5e35768a8b 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -571,6 +571,7 @@ void print_help(void)
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");
+ printf("-q min_queue_len_to_print_trace (int)\n");
}
int main(int argc, char **argv)
@@ -616,22 +617,25 @@ int main(int argc, char **argv)
return 0;
case '?':
if (optopt == 'm' || optopt == 'c' || optopt == 'p' ||
- optopt == 'f' || optopt == 't' || optopt == 'q')
+ optopt == 'f' || optopt == 't' || optopt == 'q') {
printf ("Option -%c requires an argument.\n", optopt);
- else if (isprint (optopt))
+ } else if (isprint (optopt)) {
printf ("Unknown option `-%c'.\n", optopt);
- else
- printf ( "Unknown option character `\\x%x'.\n",
-
-optopt);
+ print_help();
+ return 1;
+ } else {
+ printf ( "Unknown option character `\\x%x'.\n", optopt);
+ print_help();
return 1;
- default:
- abort ();
+ }
+ break;
+ default:
+ abort ();
}
if (mvalue == NULL || cvalue == NULL || pvalue == NULL ||
fvalue == NULL) {
- printf("options -m, -c, -p and -f required.\n");
+ printf("options -m, -c, -p and -f are required.\n");
printf("usage: %s -m maxlatency -c cycles_per_packet -p mpps(million-packet-per-sec) -f tsc_freq_mhz [-t timeout (in secs)] [-q min_queue_len_to_print_trace]\n", argv[0]);
return 1;
}
--
2.20.1
next prev parent reply other threads:[~2020-01-23 20:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-23 20:50 [PATCH 0/9] rt-tests: Miscellaneous fixes John Kacur
2020-01-23 20:50 ` [PATCH 1/9] rt-tests: queuelat: Assume queuelat is in the path John Kacur
2020-01-23 20:50 ` [PATCH 2/9] rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline John Kacur
2020-01-27 10:44 ` Kurt Kanzenbach
2020-01-27 17:40 ` John Kacur
2020-01-28 7:13 ` Kurt Kanzenbach
2020-01-23 20:50 ` [PATCH 3/9] rt-tests: pi_stress: Add short options to usage message John Kacur
2020-01-23 20:50 ` [PATCH 4/9] rt-tests: pi_stress: Sync man page with help John Kacur
2020-01-23 20:50 ` [PATCH 5/9] rt-tests: queuelat: get_cpuinfo_mhz.sh highest value John Kacur
2020-01-23 20:50 ` [PATCH 6/9] rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue John Kacur
2020-01-23 20:50 ` [PATCH 7/9] rt-tests: ptsematest: Update man page and add -h option John Kacur
2020-01-23 20:50 ` John Kacur [this message]
2020-01-23 20:50 ` [PATCH 9/9] rt-tests: svsematest: Display help with an error message for -h John Kacur
2020-01-27 21:44 ` [PATCH 0/9] rt-tests: Miscellaneous fixes Clark Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200123205029.20176-9-jkacur@redhat.com \
--to=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).