Update benchmark statistical time function
The function gettimeofday does not count the time,when testing the axpy small data volume use case. Use the function clock_gettime to replace the gettimeofday function to count the time.
This commit is contained in:
parent
445ca2f418
commit
917d243580
|
@ -128,7 +128,7 @@ int main(int argc, char *argv[]){
|
|||
int to = 200;
|
||||
int step = 1;
|
||||
|
||||
struct timeval start, stop;
|
||||
struct timespec start, stop;
|
||||
double time1,timeg;
|
||||
|
||||
argc--;argv++;
|
||||
|
@ -175,13 +175,13 @@ int main(int argc, char *argv[]){
|
|||
for(i = 0; i < m * COMPSIZE * abs(inc_y); i++){
|
||||
y[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
|
||||
}
|
||||
gettimeofday( &start, (struct timezone *)0);
|
||||
clock_gettime( CLOCK_REALTIME, &start);
|
||||
|
||||
AXPY (&m, alpha, x, &inc_x, y, &inc_y );
|
||||
|
||||
gettimeofday( &stop, (struct timezone *)0);
|
||||
clock_gettime( CLOCK_REALTIME, &stop);
|
||||
|
||||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6;
|
||||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_nsec - start.tv_nsec)) * 1.e-9;
|
||||
|
||||
timeg += time1;
|
||||
|
||||
|
@ -190,7 +190,7 @@ int main(int argc, char *argv[]){
|
|||
timeg /= loops;
|
||||
|
||||
fprintf(stderr,
|
||||
" %10.2f MFlops %10.6f sec\n",
|
||||
" %10.2f MFlops %10.9f sec\n",
|
||||
COMPSIZE * COMPSIZE * 2. * (double)m / timeg * 1.e-6, timeg);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue