66 lines
1.7 KiB
Diff
66 lines
1.7 KiB
Diff
From 16d84fa7ecea8102680c9610d4186c4f54936b07 Mon Sep 17 00:00:00 2001
|
|
From: Vivi Li <vivi.li@analog.com>
|
|
Date: Mon, 15 Jul 2024 11:07:11 +0200
|
|
Subject: [PATCH] let people specify the number of runs on the command line
|
|
|
|
Upstream: dead
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
---
|
|
dhry_1.c | 25 ++++++++++++++++++-------
|
|
1 file changed, 18 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/dhry_1.c b/dhry_1.c
|
|
index 7ab02a8..97bd30f 100644
|
|
--- a/dhry_1.c
|
|
+++ b/dhry_1.c
|
|
@@ -66,7 +66,7 @@ float Microseconds,
|
|
/* end of variables for time measurement */
|
|
|
|
|
|
-main ()
|
|
+main(int argc, char *argv[])
|
|
/*****/
|
|
|
|
/* main program, corresponds to procedures */
|
|
@@ -101,6 +101,13 @@ main ()
|
|
/* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
|
|
/* overflow may occur for this array element. */
|
|
|
|
+ Number_Of_Runs = 0;
|
|
+ if ( argc == 2 ) {
|
|
+ if (atoi(argv[1]) > 0) {
|
|
+ Number_Of_Runs = atoi(argv[1]);
|
|
+ }
|
|
+ }
|
|
+
|
|
printf ("\n");
|
|
printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
|
|
printf ("\n");
|
|
@@ -114,13 +121,17 @@ main ()
|
|
printf ("Program compiled without 'register' attribute\n");
|
|
printf ("\n");
|
|
}
|
|
- printf ("Please give the number of runs through the benchmark: ");
|
|
- {
|
|
- int n;
|
|
- scanf ("%d", &n);
|
|
- Number_Of_Runs = n;
|
|
+
|
|
+ if (!Number_Of_Runs) {
|
|
+ printf ("Please give the number of runs through the benchmark: ");
|
|
+ fflush (stdout);
|
|
+ {
|
|
+ int n;
|
|
+ scanf ("%d", &n);
|
|
+ Number_Of_Runs = n;
|
|
+ }
|
|
+ printf ("\n");
|
|
}
|
|
- printf ("\n");
|
|
|
|
printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
|
|
|
|
--
|
|
2.45.2
|
|
|