• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2------------
3Benchmarking
4------------
5There is a set a benchmarking programs in the
6"tests" directory. These should be runnable using the
7following command-lines corresponding to each of the possible
8library builds:
9
10MSVC:
11nmake clean VC-bench
12nmake clean VCE-bench
13nmake clean VSE-bench
14
15Mingw32:
16make clean GC-bench
17make clean GCE-bench
18
19UWIN:
20The benchtests are run as part of the testsuite.
21
22
23Mutex benchtests
24----------------
25
26benchtest1 - Lock plus unlock on an unlocked mutex.
27benchtest2 - Lock plus unlock on a locked mutex.
28benchtest3 - Trylock on a locked mutex.
29benchtest4 - Trylock plus unlock on an unlocked mutex.
30
31
32Each test times up to three alternate synchronisation
33implementations as a reference, and then times each of
34the four mutex types provided by the library. Each is
35described below:
36
37Simple Critical Section
38- uses a simple Win32 critical section. There is no
39additional overhead for this case as there is in the
40remaining cases.
41
42POSIX mutex implemented using a Critical Section
43- The old implementation which uses runtime adaptation
44depending on the Windows variant being run on. When
45the pthreads DLL was run on WinNT or higher then
46POSIX mutexes would use Win32 Critical Sections.
47
48POSIX mutex implemented using a Win32 Mutex
49- The old implementation which uses runtime adaptation
50depending on the Windows variant being run on. When
51the pthreads DLL was run on Win9x then POSIX mutexes
52would use Win32 Mutexes (because TryEnterCriticalSection
53is not implemented on Win9x).
54
55PTHREAD_MUTEX_DEFAULT
56PTHREAD_MUTEX_NORMAL
57PTHREAD_MUTEX_ERRORCHECK
58PTHREAD_MUTEX_RECURSIVE
59- The current implementation supports these mutex types.
60The underlying basis of POSIX mutexes is now the same
61irrespective of the Windows variant, and should therefore
62have consistent performance.
63
64
65Semaphore benchtests
66--------------------
67
68benchtest5 - Timing for various uncontended cases.
69
70
71In all benchtests, the operation is repeated a large
72number of times and an average is calculated. Loop
73overhead is measured and subtracted from all test times.
74
75