After I review the source, the failure was caused by sem_init only
support PTHREAD_PROCESS_PRIVATE,
but benchtest.c required PTHREAD_PROCESS_SHARED.

Here is my patch.

On Wed, May 25, 2011 at 22:11, Dongsheng Song <dongsheng.s...@gmail.com> wrote:
>
> Hi,
>
> With the attached patch, I can building and testing WinPthread, but benchmark 
> testing 5th failed on XP SP3:
>
> $ cd winpthreads/tests
> $ make clean GC
> ...
> ALL TESTS PASSED! Congratulations!
>
> $ make GC-bench
> Copying .././outlib/libpthreadGC2-32.dll.a
> Copying .././outlib/pthreadGC2-32.dll
> make -k TEST=GC CC=-gcc XXCFLAGS="-D__CLEANUP_C" XXLIBS="" all-bench
> make[1]: Entering directory 
> `/o/vcs/svn/mingw-w64/experimental/winpthreads/tests
> '
> Copying ../include/pthread.h
> Copying ../include/semaphore.h
> Running benchtest1
> ./benchtest1
> =============================================================================
>
> Lock plus unlock on an unlocked mutex.
> 10000000 iterations
>
> Test                                              Total(msec)   average(usec)
> -----------------------------------------------------------------------------
> Dummy call x 2                                             46           0.005
> Dummy call -> Interlocked with cond x 2                   344           0.034
> InterlockedOp x 2                                         328           0.033
> Simple Critical Section                                   360           0.036
> Old PT Mutex using a Critical Section (WNT)               406           0.041
> Old PT Mutex using a Win32 Mutex (W9x)                   9969           0.997
> .............................................................................
> PTHREAD_MUTEX_DEFAULT (W9x,WNT)                         12640           1.264
> PTHREAD_MUTEX_NORMAL (W9x,WNT)                          12610           1.261
> PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)                      12656           1.266
> PTHREAD_MUTEX_RECURSIVE (W9x,WNT)                       12969           1.297
> =============================================================================
> Done
> Compiling benchtest2.exe
> -gcc -O3 -UNDEBUG -Wall -D__CLEANUP_C benchlib.o -o benchtest2.exe 
> benchtest2.c
> -I./include -L../outlib -lpthreadGC2-32 -lsupc++
> Running benchtest2
> ./benchtest2
> =============================================================================
>
> Lock plus unlock on a locked mutex.
> 100000 iterations, four locks/unlocks per iteration.
>
> Test                                              Total(msec)   average(usec)
> -----------------------------------------------------------------------------
> Simple Critical Section                                   375           0.938
> Old PT Mutex using a Critical Section (WNT)               437           1.093
> Old PT Mutex using a Win32 Mutex (W9x)                    500           1.250
> .............................................................................
> PTHREAD_MUTEX_DEFAULT (W9x,WNT)                           640           1.600
> PTHREAD_MUTEX_NORMAL (W9x,WNT)                            609           1.523
> PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)                        656           1.640
> PTHREAD_MUTEX_RECURSIVE (W9x,WNT)                         594           1.485
> =============================================================================
> Done
> Compiling benchtest3.exe
> -gcc -O3 -UNDEBUG -Wall -D__CLEANUP_C benchlib.o -o benchtest3.exe 
> benchtest3.c
> -I./include -L../outlib -lpthreadGC2-32 -lsupc++
> Running benchtest3
> ./benchtest3
> =============================================================================
>
> Trylock on a locked mutex.
> 10000000 iterations.
>
> Test                                              Total(msec)   average(usec)
> -----------------------------------------------------------------------------
> Old PT Mutex using a Critical Section (WNT)               296           0.030
> Old PT Mutex using a Win32 Mutex (W9x)                   5375           0.537
> .............................................................................
> PTHREAD_MUTEX_DEFAULT (W9x,WNT)                          1297           0.130
> PTHREAD_MUTEX_NORMAL (W9x,WNT)                           1297           0.130
> PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)                       1297           0.130
> PTHREAD_MUTEX_RECURSIVE (W9x,WNT)                        1297           0.130
> =============================================================================
> Done
> Compiling benchtest4.exe
> -gcc -O3 -UNDEBUG -Wall -D__CLEANUP_C benchlib.o -o benchtest4.exe 
> benchtest4.c
> -I./include -L../outlib -lpthreadGC2-32 -lsupc++
> Running benchtest4
> ./benchtest4
> =============================================================================
> Trylock plus unlock on an unlocked mutex.
> 10000000 iterations.
>
> Test                                              Total(msec)   average(usec)
> -----------------------------------------------------------------------------
> Old PT Mutex using a Critical Section (WNT)               407           0.041
> Old PT Mutex using a Win32 Mutex (W9x)                  10031           1.003
> .............................................................................
> PTHREAD_MUTEX_DEFAULT (W9x,WNT)                         12797           1.280
> PTHREAD_MUTEX_NORMAL (W9x,WNT)                          12828           1.283
> PTHREAD_MUTEX_ERRORCHECK (W9x,WNT)                      12797           1.280
> PTHREAD_MUTEX_RECURSIVE (W9x,WNT)                       12937           1.294
> =============================================================================
> Done
> Compiling benchtest5.exe
> -gcc -O3 -UNDEBUG -Wall -D__CLEANUP_C benchlib.o -o benchtest5.exe 
> benchtest5.c
> -I./include -L../outlib -lpthreadGC2-32 -lsupc++
> Running benchtest5
> ./benchtest5
> =============================================================================
>
> Operations on a semaphore.
> 1000000 iterations
>
> Test                                              Total(msec)   average(usec)
> -----------------------------------------------------------------------------
> W32 Post with no waiters                                  454           0.454
> W32 Wait without blocking                                 515           0.515
> Assertion failed: (sem_init(&sema, 0, 0) == 0), file benchtest5.c, line 134
> make[1]: *** [benchtest5.bench] Error 1
> make[1]: Target `all-bench' not remade because of errors.
> make[1]: Leaving directory 
> `/o/vcs/svn/mingw-w64/experimental/winpthreads/tests'
>
> make: *** [GC-bench] Error 2
>

Attachment: winpthreads-tests-benchtest5_c.patch
Description: Binary data

Attachment: winpthreads-tests-GNUmakefile.patch
Description: Binary data

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to