[Fuego] [PATCH 1/1] lmbench2/parser.py : Allow larger bandwidth values

[email protected] Wed, 13 Apr 2022 09:54:45 +0530
Newsgroups dev.linux.lists.fuego
Message-ID <[email protected]>
From: sai ashrith <[email protected]>

While parsing the bandwidth values it is skipping the larger units (K, M, G, T)
from the result file.

Modify parser file to filter the units (K,M,G,T) and gives the calculated
decimal values for processing

Signed-off-by: sai ashrith <[email protected]>
---
 tests/Benchmark.lmbench2/parser.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tests/Benchmark.lmbench2/parser.py b/tests/Benchmark.lmbench2/parser.py
index 3a4d9b2..0f3c822 100755
--- a/tests/Benchmark.lmbench2/parser.py
+++ b/tests/Benchmark.lmbench2/parser.py
@@ -7,7 +7,7 @@ ref_section_pat = "^\[[\w\d&._/()]+.[gle]{2}\]"
 
 # 2715-T19C Linux 2.6.31.   12.0 8.6263   39.5   14.4   840.0 0.676 1.80210 5.002
 # ("-" in the pattern of interest is to handle rare cases when Mhz is reprted as -1)
-cur_search_pat = re.compile("^\S+\s+Linux\s[0-9a-z.-]+\s+([\s\d.-]*)",re.MULTILINE)
+cur_search_pat = re.compile("^\S+\s+Linux\s[0-9a-z.-]+\s+([\s\d.KMGT-]*)",re.MULTILINE)
 
 cur_dict = {}
 cur_file = open(plib.TEST_LOG,'r')
@@ -36,6 +36,14 @@ for line in lines:
 		if 0 < t_index < 8:
 			for value in test_res:
 				if len(value) > 0:
+                                        if value[-1] == 'K':
+                                                value = str(float(value.rstrip(".K"))*1000)
+                                        elif value[-1] == 'M':
+                                                value = str(float(value.rstrip(".M"))*1000*1000)
+                                        elif value[-1] == 'G':
+                                                value = str(float(value.rstrip(".G"))*1000*1000*1000)
+                                        elif value[-1] == 'T':
+                                                value = str(float(value.rstrip(".T"))*1000*1000*1000*1000)
 					sublist.append(value)
 		t_index += 1
 
@@ -44,6 +52,8 @@ cur_file.close()
 if len(sublist) == 0:
 	sys.exit("\nparser: Fuego error reason: No results found\n")
 
+
+
 cur_dict["Basic_Integer.Bit"] = sublist[0]
 cur_dict["Basic_Integer.Add"] = sublist[1]
 cur_dict["Basic_Integer.Mul"] = sublist[2]
-- 
2.20.1