[PATCH] cyclictest: only print non-zero values in histogram output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the histogram output is enabled, cyclictest dumps lines of all latencies,
even if the specific latency was never hit. For analysing a histogram, it is
sufficient to only dump latencies that actually occured. This patch skips
latencies that were never hit with respect to all threads.

If cyclictest is used in combination with --nsecs, this removes a lot of
output noise.

It shrinks output to:
  $ cyclictest --threads 2 --affinity 2-3 --priority 99 --histofall 100 --loops 100000
  # /dev/cpu_dma_latency set to 0us
  policy: fifo: loadavg: 0.03 0.13 0.07 1/560 1248

  T: 0 ( 1228) P:99 I:1000 C: 100000 Min:      2 Act:    2 Avg:    2 Max:  4
  T: 1 ( 1229) P:99 I:1000 C: 100000 Min:      2 Act:    2 Avg:    2 Max:  4
  # Histogram
  000002 069425   067138  136563
  000003 030536   032850  063386
  000004 000039   000012  000051
  # Total: 000100000 000100000 000200000
  # Min Latencies: 00002 00002
  # Avg Latencies: 00002 00002
  # Max Latencies: 00004 00004 00004
  # Histogram Overflows: 00000 00000 00000
  # Histogram Overflow at cycle number:
  # Thread 0:
  # Thread 1:

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@xxxxxxxxxxxxxxxxx>
---
 src/cyclictest/cyclictest.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 8d9ec80..0e8459c 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1988,16 +1988,23 @@ static void print_hist(struct thread_param *par[], int nthreads)
 	fprintf(fd, "# Histogram\n");
 	for (i = 0; i < histogram; i++) {
 		unsigned long long int allthreads = 0;
+		unsigned long curr_latency = 0;
+
+		for (j = 0; j < nthreads ; j++) {
+			curr_latency = par[j]->stats->hist_array[i];
+			allthreads += curr_latency;
+			log_entries[j] += curr_latency;
+		}
+		if (!allthreads)
+			continue;
 
 		fprintf(fd, "%06d ", i);
 
 		for (j = 0; j < nthreads; j++) {
-			unsigned long curr_latency=par[j]->stats->hist_array[i];
+			curr_latency = par[j]->stats->hist_array[i];
 			fprintf(fd, "%06lu", curr_latency);
 			if (j < nthreads - 1)
 				fprintf(fd, "\t");
-			log_entries[j] += curr_latency;
-			allthreads += curr_latency;
 		}
 		if (histofall && nthreads > 1) {
 			fprintf(fd, "\t%06llu", allthreads);
-- 
2.19.0




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux