This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Sat, May 03, 2014 at 12:48:31PM +0200, OndÅej BÃlka wrote:
> Its nice to have but orthogonal on proposed change, so it should not
> block this patch
This looks like something that could easily use the $bench-inputs
format since you're really just looking for mean times. I haven't
checked to see if a failed branch would be expensive compared to the
lock/unlock cycle we're testing, but I'm guessing that it should get
cached and hence not have an impact since we don't interleave the
rdlock and wrlock calls.
Siddhesh
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 63a5a7f..d74de80 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -25,7 +25,7 @@ include ../Makeconfig
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 ffs ffsll \
log log2 modf pow rint sin sincos sinh sqrt tan tanh
-bench-pthread := pthread_once
+bench-pthread := pthread_once pthread_rwlock_test
bench := $(bench-math) $(bench-pthread)
diff --git a/benchtests/pthread_rwlock_test-inputs b/benchtests/pthread_rwlock_test-inputs
new file mode 100644
index 0000000..9122afb
--- /dev/null
+++ b/benchtests/pthread_rwlock_test-inputs
@@ -0,0 +1,8 @@
+## args: int
+## includes: pthread.h
+## include-sources: pthread_rwlock_test-source.c
+
+##name: rdlock
+0
+##name: rwlock
+1
diff --git a/benchtests/pthread_rwlock_test-source.c b/benchtests/pthread_rwlock_test-source.c
new file mode 100644
index 0000000..c679f7b
--- /dev/null
+++ b/benchtests/pthread_rwlock_test-source.c
@@ -0,0 +1,13 @@
+
+static pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
+
+static void
+pthread_rwlock_test (int write)
+{
+ if (write)
+ pthread_rwlock_wrlock (&rwlock);
+ else
+ pthread_rwlock_rdlock (&rwlock);
+
+ pthread_rwlock_unlock (&rwlock);
+}
Attachment:
pgpQ65BAJMH9W.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |