summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp40
-rw-r--r--tests/benchmarks/corelib/thread/thread.pro1
2 files changed, 40 insertions, 1 deletions
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
index 54708f8639..2cb6221cee 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
@@ -44,7 +44,26 @@
#include <math.h>
-#if defined(Q_OS_UNIX)
+#ifdef Q_OS_SYMBIAN
+# include <e32std.h>
+typedef RMutex NativeMutexType;
+void NativeMutexInitialize(NativeMutexType *mutex)
+{
+ mutex->CreateLocal();
+}
+void NativeMutexDestroy(NativeMutexType *mutex)
+{
+ mutex->Close();
+}
+void NativeMutexLock(NativeMutexType *mutex)
+{
+ mutex->Wait();
+}
+void NativeMutexUnlock(NativeMutexType *mutex)
+{
+ mutex->Signal();
+}
+#elif defined(Q_OS_UNIX)
# include <pthread.h>
# include <errno.h>
typedef pthread_mutex_t NativeMutexType;
@@ -109,7 +128,9 @@ private slots:
void noThread_data();
void noThread();
+ void constructionNative();
void uncontendedNative();
+ void constructionQMutex();
void uncontendedQMutex();
void uncontendedQMutexLocker();
@@ -175,6 +196,15 @@ void tst_QMutex::noThread()
QCOMPARE(int(count), N);
}
+void tst_QMutex::constructionNative()
+{
+ QBENCHMARK {
+ NativeMutexType mutex;
+ NativeMutexInitialize(&mutex);
+ NativeMutexDestroy(&mutex);
+ }
+}
+
void tst_QMutex::uncontendedNative()
{
NativeMutexType mutex;
@@ -186,6 +216,14 @@ void tst_QMutex::uncontendedNative()
NativeMutexDestroy(&mutex);
}
+void tst_QMutex::constructionQMutex()
+{
+ QBENCHMARK {
+ QMutex mutex;
+ Q_UNUSED(mutex);
+ }
+}
+
void tst_QMutex::uncontendedQMutex()
{
QMutex mutex;
diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro
index 26570bacfe..2affee5287 100644
--- a/tests/benchmarks/corelib/thread/thread.pro
+++ b/tests/benchmarks/corelib/thread/thread.pro
@@ -1,3 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = \
+ qmutex \
qthreadstorage