--- pingpong.c.orig Fri Jan 10 19:03:45 2003 +++ pingpong.c Fri Jan 10 19:04:58 2003 @@ -7,7 +7,7 @@ * * cc -mt -xarch=v9 -xO4 pp.c -o pp64 -lpthread -lrt * */ #include -#include +/* #include */ #include #include #include @@ -69,7 +69,7 @@ main(int argc, char *argv[]) { int c; - hrtime_t t0; + struct timeval t0, t1; int ntables = 1; int target = 1000000; int sleepms = 0; @@ -159,27 +159,31 @@ barrier_init(&begin_barrier, (2 * ntables) + 1); barrier_init(&end_barrier, (2 * ntables) + 1); /* should not be needed - sigh! */ - if (concurrency > 0) { - (void) thr_setconcurrency(concurrency); - } + //if (concurrency > 0) { + //(void) thr_setconcurrency(concurrency); + //} /* initialise all games */ - t0 = gethrtime(); + gettimeofday(&t0, NULL); setup_tables(ntables, target, sleepms); /* wait for all players to be ready */ barrier_wait(&setup_barrier); if (verbose) { - (void) printf("%d threads initialised in %lldms\n", - ntables * 2, (gethrtime() - t0)/1000000LL); + gettimeofday(&t1, NULL); + timersub(&t1, &t0, &t1); + (void) printf("%d threads initialised in %ds.%dms\n", + ntables * 2, t1.tv_sec, t1.tv_usec); } /* start all games */ - t0 = gethrtime(); + gettimeofday(&t0, NULL); barrier_wait(&begin_barrier); /* wait for all games to complete */ barrier_wait(&end_barrier); if (verbose) { - (void) printf("%d games completed in %lldms\n", - ntables, (gethrtime() - t0)/1000000LL); + gettimeofday(&t1, NULL); + timersub(&t1, &t0, &t1); + (void) printf("%d games completed in %ds.%dms\n", + ntables, t1.tv_sec, t1.tv_usec); } return (0); }