Browse Source

dhrystone: Add patch to remove prompt
Standardize dhrystone to run 20 million iterations without prompt.
Rename the binary name to dhrystone.

Signed-off-by: weiheng.cheng <weiheng.cheng@starfivetech.com>

weiheng.cheng 5 months ago
parent
commit
38100047e6

+ 40 - 0
recipes-benchmark/dhrystone/dhrystone/0001-Remove-prompt.patch

@@ -0,0 +1,40 @@
+From 006a56ac03292e38992cb946b0bbf7b357bd3b44 Mon Sep 17 00:00:00 2001
+From: "weiheng.cheng" <weiheng.cheng@starfivetech.com>
+Date: Fri, 24 Nov 2023 16:39:40 +0800
+Subject: [PATCH 1/1] Remove prompt Remove prompt for number of runs when
+ DHRY_ITERS has been defined.
+
+Rebase patch using existing commit:
+https://github.com/sifive/benchmark-dhrystone/commit/bb3afcb3abd83f1541db9a0dbe47e1b284da7772
+Credit to @jstraus59
+
+Signed-off-by: weiheng.cheng <weiheng.cheng@starfivetech.com>
+---
+ dhry_1.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/dhry_1.c b/dhry_1.c
+index 1157d2d..88b69e4 100644
+--- a/dhry_1.c
++++ b/dhry_1.c
+@@ -121,6 +121,9 @@ main ()
+     printf ("Program compiled without 'register' attribute\n");
+     printf ("\n");
+   }
++#ifdef DHRY_ITERS
++  Number_Of_Runs = DHRY_ITERS;
++#else
+   printf ("Please give the number of runs through the benchmark: ");
+   {
+     int n;
+@@ -128,6 +131,7 @@ main ()
+     Number_Of_Runs = n;
+   }
+   printf ("\n");
++#endif
+ 
+   printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
+ 
+-- 
+2.25.1
+

+ 10 - 2
recipes-benchmark/dhrystone/dhrystone_2.1.bbappend

@@ -1,5 +1,13 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-Remove-prompt.patch"
+
 # Best effort
-CFLAGS = "-O2 -DTIME -Wno-implicit -fno-builtin-printf -fno-common -static -mcmodel=medany -ffast-math -fno-common -falign-jumps=8 -falign-loops=8 -falign-functions=8"
+CFLAGS = "-O2 -DTIME -Wno-implicit -fno-builtin-printf -fno-common -static -mcmodel=medany -ffast-math -fno-common -falign-jumps=8 -falign-loops=8 -falign-functions=8 -DDHRY_ITERS=20000000"
 
 # Legal
-#CFLAGS = "-O2 -DTIME -Wno-implicit -fno-builtin-printf -fno-common -static -mcmodel=medany -ffast-math -fno-common -falign-jumps=8 -falign-loops=8 -falign-functions=8 -fno-inline"
+#CFLAGS = "-O2 -DTIME -Wno-implicit -fno-builtin-printf -fno-common -static -mcmodel=medany -ffast-math -fno-common -falign-jumps=8 -falign-loops=8 -falign-functions=8 -fno-inline -DDHRY_ITERS=20000000"
+
+do_install:append() {
+	mv ${D}${bindir}/dhry ${D}${bindir}/dhrystone
+}