MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dhry_test

Function dhry_test

examples/test/dhry_1.c:57–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55/* end of variables for time measurement */
56
57void dhry_test(void)
58/*****/
59
60 /* main program, corresponds to procedures */
61 /* Main and Proc_0 in the Ada version */
62{
63 One_Fifty Int_1_Loc;
64 REG One_Fifty Int_2_Loc;
65 One_Fifty Int_3_Loc;
66 REG char Ch_Index;
67 Enumeration Enum_Loc;
68 Str_30 Str_1_Loc;
69 Str_30 Str_2_Loc;
70 REG int Run_Index;
71 REG int Number_Of_Runs;
72
73 /* Initializations */
74
75 Next_Ptr_Glob = (Rec_Pointer) rt_malloc (sizeof (Rec_Type));
76 Ptr_Glob = (Rec_Pointer) rt_malloc (sizeof (Rec_Type));
77
78 Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
79 Ptr_Glob->Discr = Ident_1;
80 Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
81 Ptr_Glob->variant.var_1.Int_Comp = 40;
82 rt_strncpy (Ptr_Glob->variant.var_1.Str_Comp,
83 "DHRYSTONE PROGRAM, SOME STRING", sizeof(Ptr_Glob->variant.var_1.Str_Comp));
84 rt_strncpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING", sizeof(Str_1_Loc));
85
86 Arr_2_Glob [8][7] = 10;
87 /* Was missing in published program. Without this statement, */
88 /* Arr_2_Glob [8][7] would have an undefined value. */
89 /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
90 /* overflow may occur for this array element. */
91
92 printf ("\n");
93 printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
94 printf ("\n");
95 if (Reg)
96 {
97 printf ("Program compiled with 'register' attribute\n");
98 printf ("\n");
99 }
100 else
101 {
102 printf ("Program compiled without 'register' attribute\n");
103 printf ("\n");
104 }
105 printf ("Please give the number of runs through the benchmark: ");
106
107 Number_Of_Runs = NUMBER_OF_RUNS;
108 printf ("%d\n", Number_Of_Runs);
109
110 printf ("\n");
111
112 printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
113
114 /***************/

Callers

nothing calls this directly

Calls 6

rt_mallocFunction · 0.85
rt_strncpyFunction · 0.85
rt_tick_getFunction · 0.85
Func_2Function · 0.85
Func_1Function · 0.85
printfFunction · 0.50

Tested by

no test coverage detected