forked from Imagelibrary/rtems
@@ -1,5 +1,5 @@
|
|||||||
rtems_tests_PROGRAMS = dhrystone
|
rtems_tests_PROGRAMS = dhrystone
|
||||||
dhrystone_SOURCES = init.c
|
dhrystone_SOURCES = init.c dhry_1.c dhry_2.c
|
||||||
|
|
||||||
dist_rtems_tests_DATA = dhrystone.scn dhrystone.doc
|
dist_rtems_tests_DATA = dhrystone.scn dhrystone.doc
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ include $(top_srcdir)/../automake/compile.am
|
|||||||
include $(top_srcdir)/../automake/leaf.am
|
include $(top_srcdir)/../automake/leaf.am
|
||||||
|
|
||||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||||
|
AM_CFLAGS += -fno-inline -fno-builtin
|
||||||
|
|
||||||
LINK_OBJS = $(dhrystone_OBJECTS)
|
LINK_OBJS = $(dhrystone_OBJECTS)
|
||||||
LINK_LIBS = $(dhrystone_LDLIBS)
|
LINK_LIBS = $(dhrystone_LDLIBS)
|
||||||
|
|||||||
@@ -345,6 +345,8 @@
|
|||||||
***************************************************************************
|
***************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define TIME
|
||||||
|
|
||||||
/* Compiler and system dependent definitions: */
|
/* Compiler and system dependent definitions: */
|
||||||
|
|
||||||
#ifndef TIME
|
#ifndef TIME
|
||||||
@@ -420,4 +422,14 @@ typedef struct record
|
|||||||
} variant;
|
} variant;
|
||||||
} Rec_Type, *Rec_Pointer;
|
} Rec_Type, *Rec_Pointer;
|
||||||
|
|
||||||
|
void Proc_1 (Rec_Pointer);
|
||||||
|
void Proc_2 (One_Fifty *);
|
||||||
|
void Proc_3 (Rec_Pointer *);
|
||||||
|
void Proc_4 (void);
|
||||||
|
void Proc_5 (void);
|
||||||
|
void Proc_6 (Enumeration, Enumeration *);
|
||||||
|
void Proc_7 (One_Fifty, One_Fifty, One_Fifty *);
|
||||||
|
void Proc_8 (Arr_1_Dim, Arr_2_Dim, int, int);
|
||||||
|
Enumeration Func_1 (Capital_Letter, Capital_Letter);
|
||||||
|
Boolean Func_2 (Str_30, Str_30);
|
||||||
|
Boolean Func_3 (Enumeration);
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
#include "dhry.h"
|
#include "dhry.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/* Global Variables: */
|
/* Global Variables: */
|
||||||
|
|
||||||
Rec_Pointer Ptr_Glob,
|
Rec_Pointer Ptr_Glob,
|
||||||
@@ -28,10 +31,6 @@ char Ch_1_Glob,
|
|||||||
int Arr_1_Glob [50];
|
int Arr_1_Glob [50];
|
||||||
int Arr_2_Glob [50] [50];
|
int Arr_2_Glob [50] [50];
|
||||||
|
|
||||||
extern char *malloc ();
|
|
||||||
Enumeration Func_1 ();
|
|
||||||
/* forward declaration necessary since Enumeration may not simply be int */
|
|
||||||
|
|
||||||
#ifndef REG
|
#ifndef REG
|
||||||
Boolean Reg = false;
|
Boolean Reg = false;
|
||||||
#define REG
|
#define REG
|
||||||
@@ -51,22 +50,30 @@ extern int times ();
|
|||||||
/* Measurements should last at least about 2 seconds */
|
/* Measurements should last at least about 2 seconds */
|
||||||
#endif
|
#endif
|
||||||
#ifdef TIME
|
#ifdef TIME
|
||||||
extern long time();
|
#include <sys/time.h>
|
||||||
/* see library function "time" */
|
/* see library function "time" */
|
||||||
|
#define time(x) Time()
|
||||||
|
static double Time(void)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
|
||||||
|
}
|
||||||
#define Too_Small_Time 2
|
#define Too_Small_Time 2
|
||||||
/* Measurements should last at least 2 seconds */
|
/* Measurements should last at least 2 seconds */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long Begin_Time,
|
double Begin_Time,
|
||||||
End_Time,
|
End_Time,
|
||||||
User_Time;
|
User_Time;
|
||||||
float Microseconds,
|
double Microseconds,
|
||||||
Dhrystones_Per_Second;
|
Dhrystones_Per_Second;
|
||||||
|
|
||||||
/* end of variables for time measurement */
|
/* end of variables for time measurement */
|
||||||
|
|
||||||
|
|
||||||
main ()
|
int main (int argc, char **argv)
|
||||||
/*****/
|
/*****/
|
||||||
|
|
||||||
/* main program, corresponds to procedures */
|
/* main program, corresponds to procedures */
|
||||||
@@ -114,14 +121,13 @@ main ()
|
|||||||
printf ("Program compiled without 'register' attribute\n");
|
printf ("Program compiled without 'register' attribute\n");
|
||||||
printf ("\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 = atoi(argv[1]);
|
||||||
|
if (Number_Of_Runs < 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
execution_start:
|
||||||
printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
|
printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
@@ -254,13 +260,14 @@ main ()
|
|||||||
printf ("Measured time too small to obtain meaningful results\n");
|
printf ("Measured time too small to obtain meaningful results\n");
|
||||||
printf ("Please increase number of runs\n");
|
printf ("Please increase number of runs\n");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
Number_Of_Runs *= 2;
|
||||||
|
goto execution_start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef TIME
|
#ifdef TIME
|
||||||
Microseconds = (float) User_Time * Mic_secs_Per_Second
|
Microseconds = User_Time * Mic_secs_Per_Second / Number_Of_Runs;
|
||||||
/ (float) Number_Of_Runs;
|
Dhrystones_Per_Second = Number_Of_Runs / User_Time;
|
||||||
Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
|
|
||||||
#else
|
#else
|
||||||
Microseconds = (float) User_Time * Mic_secs_Per_Second
|
Microseconds = (float) User_Time * Mic_secs_Per_Second
|
||||||
/ ((float) HZ * ((float) Number_Of_Runs));
|
/ ((float) HZ * ((float) Number_Of_Runs));
|
||||||
@@ -271,13 +278,15 @@ main ()
|
|||||||
printf ("%6.1f \n", Microseconds);
|
printf ("%6.1f \n", Microseconds);
|
||||||
printf ("Dhrystones per Second: ");
|
printf ("Dhrystones per Second: ");
|
||||||
printf ("%6.1f \n", Dhrystones_Per_Second);
|
printf ("%6.1f \n", Dhrystones_Per_Second);
|
||||||
|
printf ("DMIPS: ");
|
||||||
|
printf ("%5.2f \n", Dhrystones_Per_Second / 1757.0);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Proc_1 (Ptr_Val_Par)
|
void Proc_1 (Ptr_Val_Par)
|
||||||
/******************/
|
/******************/
|
||||||
|
|
||||||
REG Rec_Pointer Ptr_Val_Par;
|
REG Rec_Pointer Ptr_Val_Par;
|
||||||
@@ -311,7 +320,7 @@ REG Rec_Pointer Ptr_Val_Par;
|
|||||||
} /* Proc_1 */
|
} /* Proc_1 */
|
||||||
|
|
||||||
|
|
||||||
Proc_2 (Int_Par_Ref)
|
void Proc_2 (Int_Par_Ref)
|
||||||
/******************/
|
/******************/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
/* *Int_Par_Ref == 1, becomes 4 */
|
/* *Int_Par_Ref == 1, becomes 4 */
|
||||||
@@ -334,7 +343,7 @@ One_Fifty *Int_Par_Ref;
|
|||||||
} /* Proc_2 */
|
} /* Proc_2 */
|
||||||
|
|
||||||
|
|
||||||
Proc_3 (Ptr_Ref_Par)
|
void Proc_3 (Ptr_Ref_Par)
|
||||||
/******************/
|
/******************/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
/* Ptr_Ref_Par becomes Ptr_Glob */
|
/* Ptr_Ref_Par becomes Ptr_Glob */
|
||||||
@@ -349,7 +358,7 @@ Rec_Pointer *Ptr_Ref_Par;
|
|||||||
} /* Proc_3 */
|
} /* Proc_3 */
|
||||||
|
|
||||||
|
|
||||||
Proc_4 () /* without parameters */
|
void Proc_4 (void) /* without parameters */
|
||||||
/*******/
|
/*******/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
{
|
{
|
||||||
@@ -361,7 +370,7 @@ Proc_4 () /* without parameters */
|
|||||||
} /* Proc_4 */
|
} /* Proc_4 */
|
||||||
|
|
||||||
|
|
||||||
Proc_5 () /* without parameters */
|
void Proc_5 (void) /* without parameters */
|
||||||
/*******/
|
/*******/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "dhry.h"
|
#include "dhry.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef REG
|
#ifndef REG
|
||||||
#define REG
|
#define REG
|
||||||
/* REG becomes defined as empty */
|
/* REG becomes defined as empty */
|
||||||
@@ -27,7 +29,7 @@ extern int Int_Glob;
|
|||||||
extern char Ch_1_Glob;
|
extern char Ch_1_Glob;
|
||||||
|
|
||||||
|
|
||||||
Proc_6 (Enum_Val_Par, Enum_Ref_Par)
|
void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
|
||||||
/*********************************/
|
/*********************************/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
/* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
|
/* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
|
||||||
@@ -61,7 +63,7 @@ Enumeration *Enum_Ref_Par;
|
|||||||
} /* Proc_6 */
|
} /* Proc_6 */
|
||||||
|
|
||||||
|
|
||||||
Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
|
void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
/* executed three times */
|
/* executed three times */
|
||||||
/* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
|
/* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
|
||||||
@@ -81,7 +83,7 @@ One_Fifty *Int_Par_Ref;
|
|||||||
} /* Proc_7 */
|
} /* Proc_7 */
|
||||||
|
|
||||||
|
|
||||||
Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
|
void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* executed once */
|
/* executed once */
|
||||||
/* Int_Par_Val_1 == 3 */
|
/* Int_Par_Val_1 == 3 */
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ test set name: dhrystone
|
|||||||
|
|
||||||
directives:
|
directives:
|
||||||
|
|
||||||
TBD
|
None, this benchmark program depends on the compiler, standard libraries, the
|
||||||
|
processor and the memory system. It is more or less independent of the
|
||||||
|
operating system, except some disturbance from the system clock service.
|
||||||
|
|
||||||
concepts:
|
concepts:
|
||||||
|
|
||||||
TBD
|
This is the dhrystone benchmark ported to RTEMS.
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
*** BEGIN OF TEST DHRYSTONE ***
|
||||||
|
|
||||||
|
Dhrystone Benchmark, Version 2.1 (Language: C)
|
||||||
|
|
||||||
|
Program compiled without 'register' attribute
|
||||||
|
|
||||||
|
Execution starts, 1000000 runs through Dhrystone
|
||||||
|
Execution ends
|
||||||
|
|
||||||
|
Final values of the variables used in the benchmark:
|
||||||
|
|
||||||
|
Int_Glob: 5
|
||||||
|
should be: 5
|
||||||
|
Bool_Glob: 1
|
||||||
|
should be: 1
|
||||||
|
Ch_1_Glob: A
|
||||||
|
should be: A
|
||||||
|
Ch_2_Glob: B
|
||||||
|
should be: B
|
||||||
|
Arr_1_Glob[8]: 7
|
||||||
|
should be: 7
|
||||||
|
Arr_2_Glob[8][7]: 1000010
|
||||||
|
should be: Number_Of_Runs + 10
|
||||||
|
Ptr_Glob->
|
||||||
|
Ptr_Comp: 33770520
|
||||||
|
should be: (implementation-dependent)
|
||||||
|
Discr: 0
|
||||||
|
should be: 0
|
||||||
|
Enum_Comp: 2
|
||||||
|
should be: 2
|
||||||
|
Int_Comp: 17
|
||||||
|
should be: 17
|
||||||
|
Str_Comp: DHRYSTONE PROGRAM, SOME STRING
|
||||||
|
should be: DHRYSTONE PROGRAM, SOME STRING
|
||||||
|
Next_Ptr_Glob->
|
||||||
|
Ptr_Comp: 33770520
|
||||||
|
should be: (implementation-dependent), same as above
|
||||||
|
Discr: 0
|
||||||
|
should be: 0
|
||||||
|
Enum_Comp: 1
|
||||||
|
should be: 1
|
||||||
|
Int_Comp: 18
|
||||||
|
should be: 18
|
||||||
|
Str_Comp: DHRYSTONE PROGRAM, SOME STRING
|
||||||
|
should be: DHRYSTONE PROGRAM, SOME STRING
|
||||||
|
Int_1_Loc: 5
|
||||||
|
should be: 5
|
||||||
|
Int_2_Loc: 13
|
||||||
|
should be: 13
|
||||||
|
Int_3_Loc: 7
|
||||||
|
should be: 7
|
||||||
|
Enum_Loc: 1
|
||||||
|
should be: 1
|
||||||
|
Str_1_Loc: DHRYSTONE PROGRAM, 1'ST STRING
|
||||||
|
should be: DHRYSTONE PROGRAM, 1'ST STRING
|
||||||
|
Str_2_Loc: DHRYSTONE PROGRAM, 2'ND STRING
|
||||||
|
should be: DHRYSTONE PROGRAM, 2'ND STRING
|
||||||
|
|
||||||
|
Microseconds for one run through Dhrystone: 82.8
|
||||||
|
Dhrystones per Second: 12078.2
|
||||||
|
DMIPS: 6.87
|
||||||
|
|
||||||
|
*** END OF TEST DHRYSTONE ***
|
||||||
|
|||||||
@@ -20,15 +20,19 @@
|
|||||||
|
|
||||||
const char rtems_test_name[] = "DHRYSTONE";
|
const char rtems_test_name[] = "DHRYSTONE";
|
||||||
|
|
||||||
static void test(void)
|
int main(int argc, char **argv);
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Init(rtems_task_argument arg)
|
static void Init(rtems_task_argument arg)
|
||||||
{
|
{
|
||||||
|
char *argv[] = {
|
||||||
|
"dhrystone",
|
||||||
|
"1000000",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
TEST_BEGIN();
|
TEST_BEGIN();
|
||||||
|
|
||||||
test();
|
main(2, argv);
|
||||||
|
|
||||||
TEST_END();
|
TEST_END();
|
||||||
rtems_test_exit(0);
|
rtems_test_exit(0);
|
||||||
@@ -41,6 +45,8 @@ static void Init(rtems_task_argument arg)
|
|||||||
|
|
||||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||||
|
|
||||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||||
|
|
||||||
#define CONFIGURE_INIT
|
#define CONFIGURE_INIT
|
||||||
|
|||||||
Reference in New Issue
Block a user