[PATCH 2/2] CodeSamples/formal/herd/absperf-reduce: Enforce compare as number

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

 



>From 213bf072d15dfc3dce36b51a8bc1d35bd78e6609 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Thu, 28 May 2020 07:25:04 +0900
Subject: [PATCH 2/2] CodeSamples/formal/herd/absperf-reduce: Enforce compare as number

When there are differences in the number of digits in runtime,
absperf-reduce.sh miscalculates min and max values and shows strange
results such as:

    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-XE.litmus 13.255 11.81 9.64
                                           (avr)  (min) (max)

Fix this by adding 0 on both sides of comparison and enforce conversion
to numbers.  After this change:

    C-SB+l-o-o-u+l-o-o-u+l-o-o-u-XE.litmus 13.255 9.23 15.77

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 CodeSamples/formal/herd/absperf-reduce.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CodeSamples/formal/herd/absperf-reduce.sh b/CodeSamples/formal/herd/absperf-reduce.sh
index 0c338b8b..9cf52182 100644
--- a/CodeSamples/formal/herd/absperf-reduce.sh
+++ b/CodeSamples/formal/herd/absperf-reduce.sh
@@ -16,9 +16,9 @@ awk '
 		gsub(/user .*$/, "", curtesttime);
 		testtime_n[curtest]++;
 		testtime_sum[curtest] += curtesttime;
-		if (testtime_max[curtest] == "" || curtesttime > testtime_max[curtest])
+		if (testtime_max[curtest] == "" || curtesttime + 0 > testtime_max[curtest] + 0)
 			testtime_max[curtest] = curtesttime;
-		if (testtime_min[curtest] == "" || curtesttime < testtime_min[curtest])
+		if (testtime_min[curtest] == "" || curtesttime + 0 < testtime_min[curtest] + 0)
 			testtime_min[curtest] = curtesttime;
 	}
 }
-- 
2.17.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux