diff mbox series

[2/3] rt-tests: cyclicdeadline: Print the histogram regardless of quiet

Message ID 20240122221321.9545-2-crwood@redhat.com
State New
Headers show
Series [1/3] rt-tests: cyclics: Fix json segfault when not using histogram | expand

Commit Message

Crystal Wood Jan. 22, 2024, 10:13 p.m. UTC
The histogram printing code should not have been gated by !quiet,
even though other summary printing code is.

The non-histogram output also should not have been gated based on
the presence of the histogram.

Signed-off-by: Crystal Wood <crwood@redhat.com>
---
 src/sched_deadline/cyclicdeadline.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

John Kacur Jan. 23, 2024, 8:29 p.m. UTC | #1
On Mon, 22 Jan 2024, Crystal Wood wrote:

> The histogram printing code should not have been gated by !quiet,
> even though other summary printing code is.
> 
> The non-histogram output also should not have been gated based on
> the presence of the histogram.
> 
> Signed-off-by: Crystal Wood <crwood@redhat.com>
> ---
>  src/sched_deadline/cyclicdeadline.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index b3155547b9bb..3cb8f714b788 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1117,15 +1117,15 @@ static void loop(struct sched_data *sched_data, int nr_threads)
>  	usleep(10000);
>  	if (!quiet) {
>  		printf("\033[%dB", nr_threads + 2);
> -	} else {
> -		if (histogram) {
> -			FILE *out = histfile ? histfile : stdout;
> +	} else if (!histogram) {
> +		for (i = 0; i < nr_threads; ++i)
> +			print_stat(stdout, &sched_data[i], i, 0, 0);
> +	}
>  
> -			print_hist(out, sched_data, nr_threads);
> -		} else {
> -			for (i = 0; i < nr_threads; ++i)
> -				print_stat(stdout, &sched_data[i], i, 0, 0);
> -		}
> +	if (histogram) {
> +		FILE *out = histfile ? histfile : stdout;
> +
> +		print_hist(out, sched_data, nr_threads);
>  	}
>  }
>  
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index b3155547b9bb..3cb8f714b788 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -1117,15 +1117,15 @@  static void loop(struct sched_data *sched_data, int nr_threads)
 	usleep(10000);
 	if (!quiet) {
 		printf("\033[%dB", nr_threads + 2);
-	} else {
-		if (histogram) {
-			FILE *out = histfile ? histfile : stdout;
+	} else if (!histogram) {
+		for (i = 0; i < nr_threads; ++i)
+			print_stat(stdout, &sched_data[i], i, 0, 0);
+	}
 
-			print_hist(out, sched_data, nr_threads);
-		} else {
-			for (i = 0; i < nr_threads; ++i)
-				print_stat(stdout, &sched_data[i], i, 0, 0);
-		}
+	if (histogram) {
+		FILE *out = histfile ? histfile : stdout;
+
+		print_hist(out, sched_data, nr_threads);
 	}
 }