Re: [pthreads-devel] NGPT 2.2.0 RELEASED: TOPS LINUXTHREADS AND NPTL IN SCALABILITY AND PERFORMANCE
Saurabh Desai <[email protected]> Fri, 10 Jan 2003 18:28:11 -0700
| Newsgroups | gmane.linux.ngpt.user,gmane.linux.ngpt.devel,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
The benchmark program (pingpong) developed by Sun Microsystem can be found at http://wwws.sun.com/software/whitepapers/solaris9/multithread.pdf This patch is needed to compile and run under Linux. (See attached file: pingpong.c.diff) Thanks, - - - - - Saurabh Desai
pingpong.c.diff
(application/octet-stream, 1.7 KB)
--- 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 <pthread.h>
-#include <thread.h>
+/* #include <thread.h> */
#include <stdlib.h>
#include <strings.h>
#include <stdio.h>
@@ -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);
}