Line 36... |
Line 36... |
asm("l.mtspr r0,%0,%1": : "r" (val), "i" (SPR_TTCR));
|
asm("l.mtspr r0,%0,%1": : "r" (val), "i" (SPR_TTCR));
|
}
|
}
|
|
|
unsigned long read_timer(void)
|
unsigned long read_timer(void)
|
{
|
{
|
|
#if 0
|
unsigned long val;
|
unsigned long val;
|
|
|
asm("l.mfspr %0,r0,%1": "=r" (val) : "i" (SPR_TTCR));
|
asm("l.mfspr %0,r0,%1": "=r" (val) : "i" (SPR_TTCR));
|
return val;
|
return val;
|
|
#else
|
|
return timestamp;
|
|
#endif
|
}
|
}
|
|
|
/* Global Variables: */
|
/* Global Variables: */
|
|
|
Rec_Pointer Ptr_Glob,
|
Rec_Pointer Ptr_Glob,
|
Line 67... |
Line 71... |
Boolean Reg = true;
|
Boolean Reg = true;
|
#endif
|
#endif
|
|
|
/* variables for time measurement: */
|
/* variables for time measurement: */
|
|
|
#if DLX || OR1K
|
#define Too_Small_Time US_PER_TICK
|
#define Too_Small_Time DLX_FREQ
|
|
#else
|
|
#define Too_Small_Time 1
|
|
#endif
|
|
|
|
#define TIMER0 0
|
#define TIMER0 0
|
#define TIMER1 1
|
#define TIMER1 1
|
|
|
|
|
Line 182... |
Line 183... |
/***************/
|
/***************/
|
/* Start timer */
|
/* Start timer */
|
/***************/
|
/***************/
|
|
|
/* printf("%d", my_test2(Number_Of_Runs));*/
|
/* printf("%d", my_test2(Number_Of_Runs));*/
|
start_timer();
|
//start_timer();
|
Begin_Time = read_timer();
|
Begin_Time = read_timer();
|
|
|
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
|
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
|
{
|
{
|
|
|
Line 328... |
Line 329... |
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
|
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
|
|
|
*/
|
*/
|
|
|
|
|
|
|
User_Time = End_Time - Begin_Time;
|
User_Time = End_Time - Begin_Time;
|
/* microseconds */
|
|
|
|
printf("Begin Time = %d\n",Begin_Time);
|
printf("Timer ticks (%d - %d) =\t%d\n",End_Time,Begin_Time, User_Time);
|
printf("End Time = %d\n",End_Time);
|
|
|
|
|
|
|
// This is in ticks, convert to mS
|
|
User_Time = User_Time * (MS_PER_SEC / TICKS_PER_SEC);
|
|
|
|
/* microseconds */
|
|
|
printf ("\nNumber of Runs %i", num_runs);
|
printf ("\nNumber of Runs %i", num_runs);
|
printf ("\nBegin Time %i", Begin_Time);
|
printf ("\nElapsed time %i ms\n", User_Time);
|
printf ("\nEnd Time %i\n", End_Time);
|
|
|
|
if (User_Time < Too_Small_Time)
|
if (User_Time < MS_PER_SEC)
|
{
|
{
|
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");
|
}
|
}
|
else
|
else
|
{
|
{
|
#if DLX || OR1K
|
printf("Processor at %d MHz\n",(IN_CLK/1000000));
|
// User_Time /= DLX_FREQ;
|
|
#if DLX
|
|
printf("DLX ");
|
|
#else
|
|
#if OR1K
|
|
printf("OR1K ");
|
|
#else
|
|
printf("Unknown CPU ");
|
|
#endif
|
|
#endif
|
|
printf("at %u MHz ", DLX_FREQ);
|
|
if (PROC_6)
|
|
printf("(+PROC_6)");
|
|
printf("\n");
|
|
#endif
|
|
// Microseconds = User_Time / Number_Of_Runs;
|
// Microseconds = User_Time / Number_Of_Runs;
|
// Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
|
// Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time;
|
|
Dhrystones_Per_Second = (Number_Of_Runs * MS_PER_SEC) / User_Time;
|
printf ("Microseconds for one run through Dhrystone: ");
|
printf ("Microseconds for one run through Dhrystone: ");
|
printf ("%d us / %d runs\n", User_Time,Number_Of_Runs);
|
printf ("%d ms / %d runs\n", User_Time,Number_Of_Runs);
|
printf ("Dhrystones per Second: ");
|
printf ("Dhrystones per Second: ");
|
printf ("%d \n", Dhrystones_Per_Second);
|
printf ("%d \n", Dhrystones_Per_Second);
|
}
|
}
|
return 0;
|
return 0;
|
}
|
}
|