From: John Kacur <jkacur@redhat.com>
To: Crystal Wood <crwood@redhat.com>
Cc: Clark Williams <williams@redhat.com>, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH 3/3] rt-tests: cyclicdeadline: Remove dead "verbose" code in print_stat()
Date: Tue, 23 Jan 2024 15:29:58 -0500 (EST) [thread overview]
Message-ID: <a903d0c3-1483-3d8c-0e29-aa107fb20ec7@redhat.com> (raw)
In-Reply-To: <20240122221321.9545-3-crwood@redhat.com>
On Mon, 22 Jan 2024, Crystal Wood wrote:
> print_stat() isn't and has never been called with verbose set, and
> that codepath doesn't even print anything. Remove it.
>
> Signed-off-by: Crystal Wood <crwood@redhat.com>
> ---
> src/sched_deadline/cyclicdeadline.c | 46 ++++++++++-------------------
> 1 file changed, 15 insertions(+), 31 deletions(-)
>
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 3cb8f714b788..7525ad136d2c 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -53,7 +53,6 @@ typedef int s32;
> /* Struct for statistics */
> struct thread_stat {
> unsigned long cycles;
> - unsigned long cyclesread;
> long min;
> long max;
> long act;
> @@ -64,8 +63,6 @@ struct thread_stat {
> int threadstarted;
> int tid;
> long reduce;
> - long redmax;
> - long cycleofmax;
> };
>
> struct sched_data {
> @@ -775,36 +772,23 @@ static void print_hist(FILE *fp, struct sched_data *sd, int nthreads)
> fprintf(fp, "\n");
> }
>
> -static void print_stat(FILE *fp, struct sched_data *sd, int index, int verbose, int quiet)
> +static void print_stat(FILE *fp, struct sched_data *sd, int index, int quiet)
> {
> struct thread_stat *stat = &sd->stat;
> + char *fmt;
>
> - if (!verbose) {
> - if (quiet != 1) {
> - char *fmt;
> - if (use_nsecs)
> - fmt = "T:%2d (%5d) I:%ld C:%7lu "
> - "Min:%7ld Act:%8ld Avg:%8ld Max:%8ld\n";
> - else
> - fmt = "T:%2d (%5d) I:%ld C:%7lu "
> - "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld\n";
> - fprintf(fp, fmt, index, stat->tid,
> - sd->deadline_us, stat->cycles, stat->min, stat->act,
> - stat->cycles ?
> - (long)(stat->avg/stat->cycles) : 0, stat->max);
> - }
> - } else {
> - while (stat->cycles != stat->cyclesread) {
> - long diff = stat->values
> - [stat->cyclesread & sd->bufmsk];
> + if (quiet)
> + return;
>
> - if (diff > stat->redmax) {
> - stat->redmax = diff;
> - stat->cycleofmax = stat->cyclesread;
> - }
> - stat->cyclesread++;
> - }
> - }
> + if (use_nsecs)
> + fmt = "T:%2d (%5d) I:%ld C:%7lu Min:%7ld Act:%8ld Avg:%8ld Max:%8ld\n";
> + else
> + fmt = "T:%2d (%5d) I:%ld C:%7lu Min:%7ld Act:%5ld Avg:%5ld Max:%8ld\n";
> +
> + fprintf(fp, fmt, index, stat->tid,
> + sd->deadline_us, stat->cycles, stat->min, stat->act,
> + stat->cycles ?
> + (long)(stat->avg/stat->cycles) : 0, stat->max);
> }
>
> static u64 do_runtime(struct sched_data *sd, u64 period)
> @@ -1109,7 +1093,7 @@ 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, quiet);
> + print_stat(stdout, &sched_data[i], i, quiet);
> usleep(10000);
> if (!quiet)
> printf("\033[%dA", nr_threads);
> @@ -1119,7 +1103,7 @@ static void loop(struct sched_data *sched_data, int nr_threads)
> printf("\033[%dB", nr_threads + 2);
> } else if (!histogram) {
> for (i = 0; i < nr_threads; ++i)
> - print_stat(stdout, &sched_data[i], i, 0, 0);
> + print_stat(stdout, &sched_data[i], i, 0);
> }
>
> if (histogram) {
> --
Signed-off-by: John Kacur <jkacur@redhat.com>
next prev parent reply other threads:[~2024-01-23 20:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 22:13 [PATCH 1/3] rt-tests: cyclics: Fix json segfault when not using histogram Crystal Wood
2024-01-22 22:13 ` [PATCH 2/3] rt-tests: cyclicdeadline: Print the histogram regardless of quiet Crystal Wood
2024-01-23 20:29 ` John Kacur
2024-01-22 22:13 ` [PATCH 3/3] rt-tests: cyclicdeadline: Remove dead "verbose" code in print_stat() Crystal Wood
2024-01-23 20:29 ` John Kacur [this message]
2024-01-23 20:28 ` [PATCH 1/3] rt-tests: cyclics: Fix json segfault when not using histogram 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=a903d0c3-1483-3d8c-0e29-aa107fb20ec7@redhat.com \
--to=jkacur@redhat.com \
--cc=crwood@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 read-only IMAP folder(s) and NNTP newsgroup(s).