Changeset 954ca41 in rtems


Ignore:
Timestamp:
Mar 28, 2017, 11:44:45 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8783660
Parents:
317c1f4
git-author:
Sebastian Huber <sebastian.huber@…> (03/28/17 11:44:45)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/29/17 05:42:43)
Message:

benchmarks/dhrystone: Port to RTEMS

Update #2958.

Location:
testsuites/benchmarks/dhrystone
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • testsuites/benchmarks/dhrystone/Makefile.am

    r317c1f4 r954ca41  
    11rtems_tests_PROGRAMS = dhrystone
    2 dhrystone_SOURCES = init.c
     2dhrystone_SOURCES = init.c dhry_1.c dhry_2.c
    33
    44dist_rtems_tests_DATA = dhrystone.scn dhrystone.doc
     
    99
    1010AM_CPPFLAGS += -I$(top_srcdir)/../support/include
     11AM_CFLAGS += -fno-inline -fno-builtin
    1112
    1213LINK_OBJS = $(dhrystone_OBJECTS)
  • testsuites/benchmarks/dhrystone/dhry.h

    r317c1f4 r954ca41  
    346346 */
    347347
     348#define TIME
     349
    348350/* Compiler and system dependent definitions: */
    349351
     
    421423      } Rec_Type, *Rec_Pointer;
    422424
    423 
     425void Proc_1 (Rec_Pointer);
     426void Proc_2 (One_Fifty *);
     427void Proc_3 (Rec_Pointer *);
     428void Proc_4 (void);
     429void Proc_5 (void);
     430void Proc_6 (Enumeration, Enumeration *);
     431void Proc_7 (One_Fifty, One_Fifty, One_Fifty *);
     432void Proc_8 (Arr_1_Dim, Arr_2_Dim, int, int);
     433Enumeration Func_1 (Capital_Letter, Capital_Letter);
     434Boolean Func_2 (Str_30, Str_30);
     435Boolean Func_3 (Enumeration);
  • testsuites/benchmarks/dhrystone/dhry_1.c

    r317c1f4 r954ca41  
    1818#include "dhry.h"
    1919
     20#include <stdlib.h>
     21#include <string.h>
     22
    2023/* Global Variables: */
    2124
     
    2932int             Arr_2_Glob [50] [50];
    3033
    31 extern char     *malloc ();
    32 Enumeration     Func_1 ();
    33   /* forward declaration necessary since Enumeration may not simply be int */
    34 
    3534#ifndef REG
    3635        Boolean Reg = false;
     
    5251#endif
    5352#ifdef TIME
    54 extern long     time();
     53#include <sys/time.h>
    5554                /* see library function "time"  */
     55#define time(x) Time()
     56static double Time(void)
     57{
     58  struct timeval tv;
     59
     60  gettimeofday(&tv, NULL);
     61  return (double)tv.tv_sec + (double)tv.tv_usec * 1e-6;
     62}
    5663#define Too_Small_Time 2
    5764                /* Measurements should last at least 2 seconds */
    5865#endif
    5966
    60 long            Begin_Time,
     67double          Begin_Time,
    6168                End_Time,
    6269                User_Time;
    63 float           Microseconds,
     70double          Microseconds,
    6471                Dhrystones_Per_Second;
    6572
     
    6774
    6875
    69 main ()
     76int main (int argc, char **argv)
    7077/*****/
    7178
     
    115122    printf ("\n");
    116123  }
    117   printf ("Please give the number of runs through the benchmark: ");
    118   {
    119     int n;
    120     scanf ("%d", &n);
    121     Number_Of_Runs = n;
    122   }
    123   printf ("\n");
    124 
     124
     125  Number_Of_Runs = atoi(argv[1]);
     126  if (Number_Of_Runs < 1) {
     127    return 1;
     128  }
     129
     130execution_start:
    125131  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
    126132
     
    255261    printf ("Please increase number of runs\n");
    256262    printf ("\n");
     263    Number_Of_Runs *= 2;
     264    goto execution_start;
    257265  }
    258266  else
    259267  {
    260268#ifdef TIME
    261     Microseconds = (float) User_Time * Mic_secs_Per_Second
    262                         / (float) Number_Of_Runs;
    263     Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
     269    Microseconds = User_Time * Mic_secs_Per_Second / Number_Of_Runs;
     270    Dhrystones_Per_Second = Number_Of_Runs / User_Time;
    264271#else
    265272    Microseconds = (float) User_Time * Mic_secs_Per_Second
     
    272279    printf ("Dhrystones per Second:                      ");
    273280    printf ("%6.1f \n", Dhrystones_Per_Second);
     281    printf ("DMIPS:                                      ");
     282    printf ("%5.2f \n", Dhrystones_Per_Second / 1757.0);
    274283    printf ("\n");
    275284  }
     
    278287
    279288
    280 Proc_1 (Ptr_Val_Par)
     289void Proc_1 (Ptr_Val_Par)
    281290/******************/
    282291
     
    312321
    313322
    314 Proc_2 (Int_Par_Ref)
     323void Proc_2 (Int_Par_Ref)
    315324/******************/
    316325    /* executed once */
     
    335344
    336345
    337 Proc_3 (Ptr_Ref_Par)
     346void Proc_3 (Ptr_Ref_Par)
    338347/******************/
    339348    /* executed once */
     
    350359
    351360
    352 Proc_4 () /* without parameters */
     361void Proc_4 (void) /* without parameters */
    353362/*******/
    354363    /* executed once */
     
    362371
    363372
    364 Proc_5 () /* without parameters */
     373void Proc_5 (void) /* without parameters */
    365374/*******/
    366375    /* executed once */
  • testsuites/benchmarks/dhrystone/dhry_2.c

    r317c1f4 r954ca41  
    1818#include "dhry.h"
    1919
     20#include <string.h>
     21
    2022#ifndef REG
    2123#define REG
     
    2830
    2931
    30 Proc_6 (Enum_Val_Par, Enum_Ref_Par)
     32void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
    3133/*********************************/
    3234    /* executed once */
     
    6264
    6365
    64 Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
     66void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
    6567/**********************************************/
    6668    /* executed three times                                      */
     
    8284
    8385
    84 Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
     86void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
    8587/*********************************************************************/
    8688    /* executed once      */
  • testsuites/benchmarks/dhrystone/dhrystone.scn

    r317c1f4 r954ca41  
     1*** BEGIN OF TEST DHRYSTONE ***
     2
     3Dhrystone Benchmark, Version 2.1 (Language: C)
     4
     5Program compiled without 'register' attribute
     6
     7Execution starts, 1000000 runs through Dhrystone
     8Execution ends
     9
     10Final values of the variables used in the benchmark:
     11
     12Int_Glob:            5
     13        should be:   5
     14Bool_Glob:           1
     15        should be:   1
     16Ch_1_Glob:           A
     17        should be:   A
     18Ch_2_Glob:           B
     19        should be:   B
     20Arr_1_Glob[8]:       7
     21        should be:   7
     22Arr_2_Glob[8][7]:    1000010
     23        should be:   Number_Of_Runs + 10
     24Ptr_Glob->
     25  Ptr_Comp:          33770520
     26        should be:   (implementation-dependent)
     27  Discr:             0
     28        should be:   0
     29  Enum_Comp:         2
     30        should be:   2
     31  Int_Comp:          17
     32        should be:   17
     33  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
     34        should be:   DHRYSTONE PROGRAM, SOME STRING
     35Next_Ptr_Glob->
     36  Ptr_Comp:          33770520
     37        should be:   (implementation-dependent), same as above
     38  Discr:             0
     39        should be:   0
     40  Enum_Comp:         1
     41        should be:   1
     42  Int_Comp:          18
     43        should be:   18
     44  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
     45        should be:   DHRYSTONE PROGRAM, SOME STRING
     46Int_1_Loc:           5
     47        should be:   5
     48Int_2_Loc:           13
     49        should be:   13
     50Int_3_Loc:           7
     51        should be:   7
     52Enum_Loc:            1
     53        should be:   1
     54Str_1_Loc:           DHRYSTONE PROGRAM, 1'ST STRING
     55        should be:   DHRYSTONE PROGRAM, 1'ST STRING
     56Str_2_Loc:           DHRYSTONE PROGRAM, 2'ND STRING
     57        should be:   DHRYSTONE PROGRAM, 2'ND STRING
     58
     59Microseconds for one run through Dhrystone:   82.8
     60Dhrystones per Second:                      12078.2
     61DMIPS:                                       6.87
     62
     63*** END OF TEST DHRYSTONE ***
  • testsuites/benchmarks/dhrystone/init.c

    r317c1f4 r954ca41  
    2121const char rtems_test_name[] = "DHRYSTONE";
    2222
    23 static void test(void)
    24 {
    25 }
     23int main(int argc, char **argv);
    2624
    2725static void Init(rtems_task_argument arg)
    2826{
     27  char *argv[] = {
     28    "dhrystone",
     29    "1000000",
     30    NULL
     31  };
     32
    2933  TEST_BEGIN();
    3034
    31   test();
     35  main(2, argv);
    3236
    3337  TEST_END();
     
    4246#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
    4347
     48#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
     49
    4450#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    4551
Note: See TracChangeset for help on using the changeset viewer.