public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Daniel Wagner <dwagner@suse.de>
Cc: Clark Williams <williams@redhat.com>, linux-rt-users@vger.kernel.org
Subject: Re: [rt-tests v1 03/12] cyclicdeadline: Add quiet command line option
Date: Tue, 1 Dec 2020 02:00:38 -0500 (EST)	[thread overview]
Message-ID: <5ea99ed-d0b2-d427-d672-70eb1124cb6c@redhat.com> (raw)
In-Reply-To: <20201118190642.16006-4-dwagner@suse.de>



On Wed, 18 Nov 2020, Daniel Wagner wrote:

> The quiet option is useful for automated test setups where
> only the final result of the run is interesting. This avoids
> to fill up the logs.
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sched_deadline/cyclicdeadline.8 |  6 +++++-
>  src/sched_deadline/cyclicdeadline.c | 22 +++++++++++++++++-----
>  2 files changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.8 b/src/sched_deadline/cyclicdeadline.8
> index def42f77044a..59b60ca7bd31 100644
> --- a/src/sched_deadline/cyclicdeadline.8
> +++ b/src/sched_deadline/cyclicdeadline.8
> @@ -17,7 +17,7 @@ cyclicdeadline \- This program is used to test the deadline scheduler (SCHED_DEA
>  .PP
>  .SH SYNOPSIS
>  .B cyclicdeadline
> -.RI "[-a [CPUSET]] [-D TIME] [-h]  [-i INTV] [-s STEP] [-t NUM]"
> +.RI "[-a [CPUSET]] [-D TIME] [-h]  [-i INTV] [-s STEP] [-t NUM] [-q]"
>  .PP
>  .SH DESCRIPTION
>  .B cyclicdeadline
> @@ -43,6 +43,10 @@ The amount to increase the deadline for each task in us. (default 500us)
>  .TP
>  .B \-t \-\-threads NUM
>  The number of threads to run as deadline (default 1)
> +.TP
> +.B \-q, \-\-quiet
> +Print a summary only on exit. Useful for automated tests, where only
> +the summary output needs to be captured.
>  .br
>  .SH AUTHOR
>  cyclicdeadline was written by Steven Rostedt <rostedt@goodmis.org>
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 7adc91465f44..40b514c5e7e0 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -108,6 +108,8 @@ static int use_nsecs;
>  
>  static int mark_fd;
>  
> +static int quiet;
> +
>  static int find_mount(const char *mount, char *debugfs)
>  {
>  	char type[100];
> @@ -627,6 +629,7 @@ static void usage(int error)
>  	       "-s STEP     --step         The amount to increase the deadline for each task in us\n"
>  	       "                           (default 500us).\n"
>  	       "-t NUM      --threads      The number of threads to run as deadline (default 1).\n"
> +	       "-q          --quiet        print a summary only on exit\n"
>  	       );
>  	exit(error);
>  }
> @@ -966,13 +969,18 @@ static void loop(struct sched_data *sched_data, int nr_threads)
>  
>  	while (!shutdown) {
>  		for (i = 0; i < nr_threads; i++)
> -			print_stat(stdout, &sched_data[i], i, 0, 0);
> +			print_stat(stdout, &sched_data[i], i, 0, quiet);
>  		usleep(10000);
> -		printf("\033[%dA", nr_threads);
> +		if (!quiet)
> +			printf("\033[%dA", nr_threads);
>  	}
>  	usleep(10000);
> -	for (i = 0; i < nr_threads; i++)
> -		printf("\n");
> +	if (!quiet) {
> +		printf("\033[%dB", nr_threads + 2);
> +	} else {
> +		for (i = 0; i < nr_threads; ++i)
> +			print_stat(stdout, &sched_data[i], i, 0, 0);
> +	}
>  }
>  
>  int main(int argc, char **argv)
> @@ -1006,9 +1014,10 @@ int main(int argc, char **argv)
>  			{ "help",	no_argument,		NULL,	'h' },
>  			{ "interval",	required_argument,	NULL,	'i' },
>  			{ "threads",	required_argument,	NULL,	't' },
> +			{ "quiet",	no_argument,		NULL,	'q' },
>  			{ NULL,		0,			NULL,	0   },
>  		};
> -		c = getopt_long(argc, argv, "a::c:D:hi:t:", options, NULL);
> +		c = getopt_long(argc, argv, "a::c:D:hi:t:q", options, NULL);
>  		if (c == -1)
>  			break;
>  		switch (c) {
> @@ -1035,6 +1044,9 @@ int main(int argc, char **argv)
>  		case 'D':
>  			duration = parse_time_string(optarg);
>  			break;
> +		case 'q':
> +			quiet = 1;
> +			break;
>  		case 'h':
>  			usage(0);
>  			break;
> -- 
> 2.29.2
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

  reply	other threads:[~2020-12-01  7:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 19:06 [rt-tests v1 00/12] Add quiet command line option Daniel Wagner
2020-11-18 19:06 ` [rt-tests v1 01/12] cyclicdeadline: Remove dead code Daniel Wagner
2020-11-19  6:54   ` Punit Agrawal
2020-11-19  8:19     ` Daniel Wagner
2020-12-01  6:30   ` John Kacur
2020-12-01  8:21     ` Daniel Wagner
2020-11-18 19:06 ` [rt-tests v1 02/12] cyclicdeadline: Use common error handlers Daniel Wagner
2020-12-01  6:57   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 03/12] cyclicdeadline: Add quiet command line option Daniel Wagner
2020-12-01  7:00   ` John Kacur [this message]
2020-11-18 19:06 ` [rt-tests v1 04/12] pmqtest: Move statictic output into print_stat() Daniel Wagner
2020-12-01  7:02   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 05/12] pmqtest: Add quiet command line option Daniel Wagner
2020-12-01  7:04   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 06/12] ptsematest: Move statictic output into print_stat() Daniel Wagner
2020-12-01  7:06   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 07/12] ptsematest: Add quiet command line option Daniel Wagner
2020-12-01  7:09   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 08/12] svsematest: Move statictic output into print_stat() Daniel Wagner
2020-12-01  7:11   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 09/12] svsematest: Add quiet command line option Daniel Wagner
2020-12-01  7:12   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 10/12] sigwaittest: Move statictic output into print_stat() Daniel Wagner
2020-12-01  7:14   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 11/12] sigwaittest: Add quiet command line option Daniel Wagner
2020-12-01  7:16   ` John Kacur
2020-11-18 19:06 ` [rt-tests v1 12/12] rt-migrate-test: " Daniel Wagner
2020-12-01  7:17   ` John Kacur
2020-11-20 16:33 ` [rt-tests v1 00/12] " Daniel Wagner

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=5ea99ed-d0b2-d427-d672-70eb1124cb6c@redhat.com \
    --to=jkacur@redhat.com \
    --cc=dwagner@suse.de \
    --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