summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt1
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp7
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt b/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
index 8872a50227..923bfba117 100644
--- a/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
@@ -8,6 +8,7 @@ qt_internal_add_benchmark(tst_bench_qmutex
SOURCES
tst_qmutex.cpp
PUBLIC_LIBRARIES
+ Qt::CorePrivate
Qt::Test
)
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
index 9cea995433..9b14cbca5d 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
@@ -28,6 +28,7 @@
#include <QtCore/QtCore>
#include <QTest>
+#include <QtCore/private/qvolatile_p.h>
#include <math.h>
@@ -158,7 +159,7 @@ void tst_QMutex::noThread()
QBENCHMARK {
count = 0;
for (int i = 0; i < N; i++) {
- count++;
+ QtPrivate::volatilePreIncrement(count);
}
}
break;
@@ -167,7 +168,7 @@ void tst_QMutex::noThread()
count = 0;
for (int i = 0; i < N; i++) {
mtx.lock();
- count++;
+ QtPrivate::volatilePreIncrement(count);
mtx.unlock();
}
}
@@ -177,7 +178,7 @@ void tst_QMutex::noThread()
count = 0;
for (int i = 0; i < N; i++) {
QMutexLocker locker(&mtx);
- count++;
+ QtPrivate::volatilePreIncrement(count);
}
}
break;