Linux-rt-users Archive on lore.kernel.org
 help / color / Atom feed
From: Daniel Wagner <dwagner@suse.de>
To: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Cc: linux-rt-users@vger.kernel.org, Daniel Wagner <dwagner@suse.de>
Subject: [rt-tests v2 16/18] ssdd: Streamline usage and man page
Date: Wed,  7 Oct 2020 10:56:51 +0200
Message-ID: <20201007085653.11961-17-dwagner@suse.de> (raw)
In-Reply-To: <20201007085653.11961-1-dwagner@suse.de>

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ssdd/ssdd.8 | 35 +++++++++++++++++-----------------
 src/ssdd/ssdd.c | 50 +++++++++++++++++++++++++++----------------------
 2 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/src/ssdd/ssdd.8 b/src/ssdd/ssdd.8
index 99f30145d079..5c29d0abb732 100644
--- a/src/ssdd/ssdd.8
+++ b/src/ssdd/ssdd.8
@@ -1,31 +1,30 @@
-.TH SSDD 8 "June 13, 2019"
+.TH SSDD 8 "September 19, 2020"
 .SH NAME
 ssdd \- have a tracer do a bunch of PTRACE_SINGLESTEPs
 .SH SYNOPSIS
-.B ssdd
-.RI "<options>"
+.LP
+ssdd [-f|--forks NUM] [-h|--help] [-i|--iters NUM]
 .SH DESCRIPTION
-Have a tracer do a bunch of PTRACE_SINGLESTEPs against
-a tracee as fast as possible.  Create several of these
-tracer/tracee pairs and see if they can be made to
-interfere with each other.
-The tracer waits on each PTRACE_SINGLESTEP with a waitpid(2)
-and checks that waitpid's return values for correctness.
+Have a tracer do a bunch of PTRACE_SINGLESTEPs against a tracee as
+fast as possible. Create several of these tracer/tracee pairs and
+see if they can be made to interfere with each other. The tracer
+waits on each PTRACE_SINGLESTEP with a waitpid(2) and checks that
+waitpid's return values for correctness.
 .SH OPTIONS
-.B \-f, \-\-forks
-number of tracer/tracee pairs to fork off.
-Default is 10.
-.br
 .TP
-.B \-i, \-\-iters
-number of PTRACE_SINGLESTEP iterations to
-do before declaring success, for each tracer/
-tracee pair set up. Default is 10,000.
+.B \-f, \-\-forks=NUM
+number of tracer/tracee pairs to fork off.
 .br
+Default is 10.
 .TP
 .B \-h, \-\-help
 Display usage
-
+.TP
+.B \-i, \-\-iters=NUM
+number of PTRACE_SINGLESTEP iterations to do before declaring
+success, for each tracer tracee pair set up.
+.br
+Default is 10,000.
 .SH AUTHOR
 ssdd was written by Joe Korty <joe.korty@concurrent-rt.com>
 .PP
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index f165da96e23a..66d6009dc572 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -68,13 +68,16 @@ static int got_sigchld;
 
 enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP };
 
-static void usage()
+static void usage(int error)
 {
-	printf("ssdd <options>\n");
-	printf("\t-f --forks=<number of forks>\n");
-	printf("\t-i --iters=<number of iterations>\n");
-	printf("\t-h --help\n");
-	exit(0);
+	printf("ssdd V %1.2f\n", VERSION);
+	printf("Usage:\n"
+	       "ssdd <options>\n\n"
+	       "-f       --forks=NUM       number of forks\n"
+	       "-h       --help            print this message\n"
+	       "-i       --iters=NUM       number of iterations\n"
+	       );
+	exit(error);
 }
 
 static int do_wait(pid_t *wait_pid, int *ret_sig)
@@ -292,27 +295,30 @@ int main(int argc, char **argv)
 		int option_index = 0;
 
 		static struct option long_options[] = {
-			{"forks", required_argument, NULL, OPT_NFORKS},
-			{"iters", required_argument, NULL, OPT_NITERS},
-			{"help", no_argument, NULL, OPT_HELP},
+			{"forks",		required_argument,	NULL, OPT_NFORKS},
+			{"help",		no_argument,		NULL, OPT_HELP},
+			{"iters",		required_argument,	NULL, OPT_NITERS},
 			{NULL, 0, NULL, 0},
 		};
-		int c = getopt_long(argc, argv, "f:i:h", long_options, &option_index);
+		int c = getopt_long(argc, argv, "f:hi:", long_options, &option_index);
 		if (c == -1)
 			break;
 		switch(c) {
-			case 'f':
-			case OPT_NFORKS:
-				nforks = atoi(optarg);
-				break;
-			case 'i':
-			case OPT_NITERS:
-				nsteps = atoi(optarg);
-				break;
-			case 'h':
-			case OPT_HELP:
-				usage();
-				break;
+		case 'f':
+		case OPT_NFORKS:
+			nforks = atoi(optarg);
+			break;
+		case 'h':
+		case OPT_HELP:
+			usage(0);
+			break;
+		case 'i':
+		case OPT_NITERS:
+			nsteps = atoi(optarg);
+			break;
+		default:
+			usage(1);
+			break;
 		}
 	}
 
-- 
2.28.0


  parent reply index

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  8:56 [rt-tests v2 00/18] Streamline command line Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 01/18] rt-util: Move parse_cpumask from cyclictest Daniel Wagner
2020-10-23 15:46   ` John Kacur
2020-10-26 18:34     ` Daniel Wagner
2020-10-29 15:45       ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 02/18] cyclictest: Use numa library helpers in get_available_cpus() Daniel Wagner
2020-10-23 15:55   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 03/18] cyclicdeadline: Streamline usage output and man page Daniel Wagner
2020-10-23 16:01   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 04/18] cyclicdeadline: Add long command line options Daniel Wagner
2020-10-23 16:07   ` John Kacur
2020-10-27  8:07     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 05/18] deadline_test: Streamline usage output and man page Daniel Wagner
2020-10-23 16:10   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 06/18] oslat: " Daniel Wagner
2020-10-23 17:19   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 07/18] oslat: Use string parser utilies Daniel Wagner
2020-10-23 17:25   ` John Kacur
2020-10-27  8:09     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 08/18] pip_stress: Add command line parser Daniel Wagner
2020-10-23 17:33   ` John Kacur
2020-10-27  8:09     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 09/18] pi_stress: Streamline usage output and man page Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 10/18] pmqtest: " Daniel Wagner
2020-10-23 18:18   ` John Kacur
2020-10-23 18:23   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 11/18] ptsematest: " Daniel Wagner
2020-10-23 18:25   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 12/18] queuelat: Streamline usage " Daniel Wagner
2020-10-23 18:40   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 13/18] rt-migrate-test: " Daniel Wagner
2020-10-23 18:47   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 14/18] signaltest: " Daniel Wagner
2020-10-23 18:50   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 15/18] sigwaittest: " Daniel Wagner
2020-10-23 18:51   ` John Kacur
2020-10-07  8:56 ` Daniel Wagner [this message]
2020-10-23 18:57   ` [rt-tests v2 16/18] ssdd: " John Kacur
2020-10-07  8:56 ` [rt-tests v2 17/18] svsematest: " Daniel Wagner
2020-10-23 18:59   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 18/18] hackbench: " Daniel Wagner
2020-10-23 19:03   ` John Kacur

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=20201007085653.11961-17-dwagner@suse.de \
    --to=dwagner@suse.de \
    --cc=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

Linux-rt-users Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rt-users/0 linux-rt-users/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rt-users linux-rt-users/ https://lore.kernel.org/linux-rt-users \
		linux-rt-users@vger.kernel.org
	public-inbox-index linux-rt-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rt-users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git