diff mbox series

[2/4] rt-tests: cyclictest: Remove histogram totals

Message ID 20231206205508.17148-3-crwood@redhat.com
State New
Headers show
Series rt-tests: cyclicdeadline: Add histogram support | expand

Commit Message

Crystal Wood Dec. 6, 2023, 8:55 p.m. UTC
The Total: line does not seem to contribute much value, as it should just
be the number of buckets minus the number of overflows.  Unless someone
complains, remove it to simplify moving to common histogram code.

Signed-off-by: Crystal Wood <crwood@redhat.com>
---
 src/cyclictest/cyclictest.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Comments

John Kacur Dec. 13, 2023, 3:58 p.m. UTC | #1
On Wed, 6 Dec 2023, Crystal Wood wrote:

> The Total: line does not seem to contribute much value, as it should just
> be the number of buckets minus the number of overflows.  Unless someone
> complains, remove it to simplify moving to common histogram code.
> 
> Signed-off-by: Crystal Wood <crwood@redhat.com>
> ---
>  src/cyclictest/cyclictest.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index a8039b49feb6..93ce201e9fca 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1407,12 +1407,9 @@ static void print_tids(struct thread_param *par[], int nthreads)
>  static void print_hist(struct thread_param *par[], int nthreads)
>  {
>  	int i, j;
> -	unsigned long long int log_entries[nthreads+1];
>  	unsigned long maxmax, alloverflows;
>  	FILE *fd;
>  
> -	bzero(log_entries, sizeof(log_entries));
> -
>  	if (use_histfile) {
>  		fd = fopen(histfile, "w");
>  		if (!fd) {
> @@ -1434,21 +1431,12 @@ static void print_hist(struct thread_param *par[], int nthreads)
>  			fprintf(fd, "%06lu", curr_latency);
>  			if (j < nthreads - 1)
>  				fprintf(fd, "\t");
> -			log_entries[j] += curr_latency;
>  			allthreads += curr_latency;
>  		}
> -		if (histofall && nthreads > 1) {
> +		if (histofall && nthreads > 1)
>  			fprintf(fd, "\t%06llu", allthreads);
> -			log_entries[nthreads] += allthreads;
> -		}
>  		fprintf(fd, "\n");
>  	}
> -	fprintf(fd, "# Total:");
> -	for (j = 0; j < nthreads; j++)
> -		fprintf(fd, " %09llu", log_entries[j]);
> -	if (histofall && nthreads > 1)
> -		fprintf(fd, " %09llu", log_entries[nthreads]);
> -	fprintf(fd, "\n");
>  	fprintf(fd, "# Min Latencies:");
>  	for (j = 0; j < nthreads; j++)
>  		fprintf(fd, " %05lu", par[j]->stats->min);
> -- 
> 2.43.0
> 
> 

-Tested with rteval
Signed-off-by: John Kacur <jkacur@redhat.com>
Crystal Wood Dec. 13, 2023, 4:18 p.m. UTC | #2
On Wed, 2023-12-06 at 14:55 -0600, Crystal Wood wrote:
> The Total: line does not seem to contribute much value, as it should just
> be the number of buckets minus the number of overflows.  Unless someone
> complains, remove it to simplify moving to common histogram code.

Eh, that should be "number of cycles", not "number of buckets". :-P

-Crystal
John Kacur Dec. 13, 2023, 4:21 p.m. UTC | #3
On Wed, 6 Dec 2023, Crystal Wood wrote:

> The Total: line does not seem to contribute much value, as it should just
> be the number of buckets minus the number of overflows.  Unless someone
> complains, remove it to simplify moving to common histogram code.
> 
> Signed-off-by: Crystal Wood <crwood@redhat.com>
> ---
>  src/cyclictest/cyclictest.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index a8039b49feb6..93ce201e9fca 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1407,12 +1407,9 @@ static void print_tids(struct thread_param *par[], int nthreads)
>  static void print_hist(struct thread_param *par[], int nthreads)
>  {
>  	int i, j;
> -	unsigned long long int log_entries[nthreads+1];
>  	unsigned long maxmax, alloverflows;
>  	FILE *fd;
>  
> -	bzero(log_entries, sizeof(log_entries));
> -
>  	if (use_histfile) {
>  		fd = fopen(histfile, "w");
>  		if (!fd) {
> @@ -1434,21 +1431,12 @@ static void print_hist(struct thread_param *par[], int nthreads)
>  			fprintf(fd, "%06lu", curr_latency);
>  			if (j < nthreads - 1)
>  				fprintf(fd, "\t");
> -			log_entries[j] += curr_latency;
>  			allthreads += curr_latency;
>  		}
> -		if (histofall && nthreads > 1) {
> +		if (histofall && nthreads > 1)
>  			fprintf(fd, "\t%06llu", allthreads);
> -			log_entries[nthreads] += allthreads;
> -		}
>  		fprintf(fd, "\n");
>  	}
> -	fprintf(fd, "# Total:");
> -	for (j = 0; j < nthreads; j++)
> -		fprintf(fd, " %09llu", log_entries[j]);
> -	if (histofall && nthreads > 1)
> -		fprintf(fd, " %09llu", log_entries[nthreads]);
> -	fprintf(fd, "\n");
>  	fprintf(fd, "# Min Latencies:");
>  	for (j = 0; j < nthreads; j++)
>  		fprintf(fd, " %05lu", par[j]->stats->min);
> -- 
> 2.43.0
> 
> 
> 
- Tested in rteval
- Edited commit message to say "cycles" instead of buckets
Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index a8039b49feb6..93ce201e9fca 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1407,12 +1407,9 @@  static void print_tids(struct thread_param *par[], int nthreads)
 static void print_hist(struct thread_param *par[], int nthreads)
 {
 	int i, j;
-	unsigned long long int log_entries[nthreads+1];
 	unsigned long maxmax, alloverflows;
 	FILE *fd;
 
-	bzero(log_entries, sizeof(log_entries));
-
 	if (use_histfile) {
 		fd = fopen(histfile, "w");
 		if (!fd) {
@@ -1434,21 +1431,12 @@  static void print_hist(struct thread_param *par[], int nthreads)
 			fprintf(fd, "%06lu", curr_latency);
 			if (j < nthreads - 1)
 				fprintf(fd, "\t");
-			log_entries[j] += curr_latency;
 			allthreads += curr_latency;
 		}
-		if (histofall && nthreads > 1) {
+		if (histofall && nthreads > 1)
 			fprintf(fd, "\t%06llu", allthreads);
-			log_entries[nthreads] += allthreads;
-		}
 		fprintf(fd, "\n");
 	}
-	fprintf(fd, "# Total:");
-	for (j = 0; j < nthreads; j++)
-		fprintf(fd, " %09llu", log_entries[j]);
-	if (histofall && nthreads > 1)
-		fprintf(fd, " %09llu", log_entries[nthreads]);
-	fprintf(fd, "\n");
 	fprintf(fd, "# Min Latencies:");
 	for (j = 0; j < nthreads; j++)
 		fprintf(fd, " %05lu", par[j]->stats->min);