[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: NPTL <=> NGPT performance test results with pingpong benchmark



Let us sync our test cases first. Here is the patch I apply to
the sun's program to work around Solaris specific things.

Correct me if there are something wrong.

--- pingpong.orig.c	2002-11-20 11:43:11.000000000 +0800
+++ pingpong.c	2002-11-20 11:12:53.000000000 +0800
@@ -6,7 +6,7 @@
 */
 
 #include <pthread.h>
-#include <thread.h>
+/*#include <thread.h>*/
 #include <stdlib.h>
 #include <strings.h>
 #include <stdio.h>
@@ -72,7 +72,8 @@
 main(int argc, char *argv[])
 {
 int c;
-hrtime_t t0;
+struct timeval t0,t1;
+float timeuse;
 int ntables = 1;
 int target = 1000000;
 int sleepms = 0;
@@ -164,28 +165,32 @@
 barrier_init(&end_barrier, (2 * ntables) + 1);
 
 /* should not be needed - sigh! */
-if (concurrency > 0) {
+/*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);
+timeuse=1000000*(t1.tv_sec-t0.tv_sec)+(t1.tv_usec-t0.tv_usec);
+(void) printf("%d threads initialised in %fms\n", ntables * 2, timeuse /
1000);
 }
 
 /* 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);
+timeuse=1000000*(t1.tv_sec-t0.tv_sec)+(t1.tv_usec-t0.tv_usec);
+(void) printf("%d games completed in %fms\n",ntables, timeuse / 1000);
 }
 return (0);
 }


-----Original Message-----
From: Saurabh Desai [mailto:sdesai austin ibm com]
Sent: 2002?12?7? 8:07
To: phil-list redhat com
Cc: Liu, Bing Wei
Subject: Re: NPTL <=> NGPT performance test results with pingpong benchmark


Ingo Molnar wrote:
> 
> On Wed, 4 Dec 2002, Liu, Bing Wei wrote:
> 
> > Has anyone tried some performance tests to compare certain aspect of
> > nptl and ngpt? I found a program named pingpong in a white paper at
> > http://wwws.sun.com/software/whitepapers/solaris9/multithread.pdf, which
> > was devised to evaluate the efficiency of lock/unlock operation and
> > context switch.
> >
> > With a SMP machine (2xPIII 933MHz w/ 512MB), on top of kernel 2.5.49,
> > I run a round of tests with both ngpt 2.0.4 and nptl 0.10.
> 
> i've organized your results into a bit more compact form:
> 
>                                 NGPT 2.0.4     NPTL 0.10    ( speedup )
> -----------------------------------------------------------------------
>  pp32                             15.2 sec       4.5 sec    (   230%  )
>  pp32 -s system                   16.3 sec       4.5 sec    (   260%  )
>  pp32 -n 4                        54.0 sec      30.8 sec    (    70%  )
>  pp32 -n 4 -p shared             174.1 sec      27.3 sec    (   530%  )
>  pp32 -n 4000 -i 100 -S 32768    211.4 sec      10.1 sec    (  1990%  )
> -----------------------------------------------------------------------
> 
> what you measured is in line with our preliminary tests, where we found a
> 4x speedup over NGPT. (and an 8x speedup over LinuxThreads.)
> 
 
When I ran this program on a 4-way SMP system (4xPIII 700MHZ w/1GB) on 
top of 2.5.49 kernel, using NPTL 0.10 (latest glibc), the results are
real strange.

pp32 -n 128 -i 100 takes more than 40 sec
pp32 -n 128 -i 10 also takes 35sec
pp32 -n 4000 -i 100 -S 32768 didn't complete (hangs or takes long time)

As the iteration (-i) goes down, it behaves badly.
Am I missing something?


- Saurabh





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]