--- ./dhry_1.c.org 2023-02-15 17:49:05.771410126 +0900 +++ ./dhry_1.c 2023-02-15 17:55:28.958053091 +0900 @@ -17,7 +17,15 @@ #include "dhry.h" +#include "t_syslog.h" +#include "stdio.h" /* Global Variables: */ +#define printf(...) syslog(LOG_INFO, __VA_ARGS__) + +extern uint8 shared_memory[16][16]; +extern uint8 result_array[4][17]; +extern void float_to_char(uint8 input_array[], float input); +extern void int_to_char(uint8 input_array[], int input); Rec_Pointer Ptr_Glob, Next_Ptr_Glob; @@ -51,7 +59,7 @@ extern int times (); /* Measurements should last at least about 2 seconds */ #endif #ifdef TIME -extern long time(); +extern uint32 time(); /* see library function "time" */ #define Too_Small_Time 2 /* Measurements should last at least 2 seconds */ @@ -70,7 +78,8 @@ float Microseconds, /* end of variables for time measurement */ -main () +// main () +dhrystone_main() /*****/ /* main program, corresponds to procedures */ @@ -85,6 +94,8 @@ main () Str_30 Str_2_Loc; REG int Run_Index; REG int Number_Of_Runs; + int i, j; + char buf[17]; /* Initializations */ @@ -118,13 +129,9 @@ 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; - } - printf ("\n"); + Number_Of_Runs = 10000000; + strcpy (&shared_memory[0], "DHRYSTONE PROG "); + strcpy (&shared_memory[1], "is now running"); printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); @@ -277,11 +284,31 @@ main () Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs) / (float) User_Time; #endif - printf ("Microseconds for one run through Dhrystone: "); - printf ("%6.1f \n", Microseconds); - printf ("Dhrystones per Second: "); - printf ("%6.1f \n", Dhrystones_Per_Second); - printf ("\n"); + strcpy (&shared_memory[ 1], "is finished !! "); + strcpy (&shared_memory[ 2], " "); + strcpy (&shared_memory[ 3], " "); + strcpy (&shared_memory[ 4], "Result "); + strcpy (&shared_memory[ 5], "----------------"); + strcpy (&shared_memory[ 6], "msec/dhrystone "); + float_to_char(&result_array[0], Microseconds); + strcpy (&shared_memory[ 7], result_array[0] ); + strcpy (&shared_memory[ 8], "Dhrystone/sec "); + float_to_char(&result_array[1], Dhrystones_Per_Second); + strcpy (&shared_memory[ 9], result_array[1] ); + strcpy (&shared_memory[10], "DMIPS(VAX MIPS) "); + float_to_char(&result_array[2], Dhrystones_Per_Second/1757.0); + strcpy (&shared_memory[11], result_array[2] ); + strcpy (&shared_memory[12], "MIPS/MHz @400MHz"); + float_to_char(&result_array[3], Dhrystones_Per_Second/1757.0/400.0); + strcpy (&shared_memory[13], result_array[3] ); + strcpy (&shared_memory[14], " "); + strcpy (&shared_memory[15], " "); + + buf[17] = '\0'; + for(i=0; i<16;++i){ + strncpy(buf, shared_memory[i], 16); + printf("%s", buf); + } } }