board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / dhrystone / 0001-cmdline-nruns.patch
blob1164610cca1973f39a09198ceefad691b5ef136e
1 let people specify the number of runs on the command line
3 Patch by Vivi Li <vivi.li@analog.com>
5 --- a/dhry_1.c
6 +++ b/dhry_1.c
7 @@ -66,7 +70,7 @@
8 /* end of variables for time measurement */
11 -main ()
12 +main(int argc, char *argv[])
13 /*****/
15 /* main program, corresponds to procedures */
16 @@ -101,6 +105,13 @@
17 /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
18 /* overflow may occur for this array element. */
20 + Number_Of_Runs = 0;
21 + if ( argc == 2 ) {
22 + if (atoi(argv[1]) > 0) {
23 + Number_Of_Runs = atoi(argv[1]);
24 + }
25 + }
27 printf ("\n");
28 printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
29 printf ("\n");
30 @@ -114,13 +125,17 @@
31 printf ("Program compiled without 'register' attribute\n");
32 printf ("\n");
34 - printf ("Please give the number of runs through the benchmark: ");
35 - {
36 - int n;
37 - scanf ("%d", &n);
38 - Number_Of_Runs = n;
40 + if (!Number_Of_Runs) {
41 + printf ("Please give the number of runs through the benchmark: ");
42 + fflush (stdout);
43 + {
44 + int n;
45 + scanf ("%d", &n);
46 + Number_Of_Runs = n;
47 + }
48 + printf ("\n");
50 - printf ("\n");
52 printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);