summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-10-13 09:18:05 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-10-19 06:21:51 +0000
commitf939e7ea7375dbc051c81abf7b24c6fd5304cbbb (patch)
tree5f7d1692b017cb5f8fd35ea92285b23e69cfeb50 /src/testlib
parent6a7b683817e7427cf952130b7726833fd5be74ce (diff)
Testlib: Move classes inheriting QBenchmarkMeasurerBase to separate header
QBenchmarkTimeMeasurer uses the 3rd party header cycle_p.h which may include windows.h on Windows (32bit). This can cause clashes in qmltest, which uses QBenchmarkMeasurerBase. Move the derived classes to a separate header to prevent this. Change-Id: I943a11c32a575594e6e79e722e8809b42de35092 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qbenchmark.cpp1
-rw-r--r--src/testlib/qbenchmarkmeasurement.cpp2
-rw-r--r--src/testlib/qbenchmarkmeasurement_p.h36
-rw-r--r--src/testlib/qbenchmarktimemeasurers_p.h96
-rw-r--r--src/testlib/testlib.pro1
5 files changed, 99 insertions, 37 deletions
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp
index c884d5d740..c933a16c35 100644
--- a/src/testlib/qbenchmark.cpp
+++ b/src/testlib/qbenchmark.cpp
@@ -40,6 +40,7 @@
#include <QtTest/qbenchmark.h>
#include <QtTest/private/qbenchmark_p.h>
#include <QtTest/private/qbenchmarkmetric_p.h>
+#include <QtTest/private/qbenchmarktimemeasurers_p.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
diff --git a/src/testlib/qbenchmarkmeasurement.cpp b/src/testlib/qbenchmarkmeasurement.cpp
index ac4d75ce3b..228ab15f99 100644
--- a/src/testlib/qbenchmarkmeasurement.cpp
+++ b/src/testlib/qbenchmarkmeasurement.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include <QtTest/private/qbenchmarkmeasurement_p.h>
+#include <QtTest/private/qbenchmarktimemeasurers_p.h>
#include <QtTest/private/qbenchmark_p.h>
#include <QtTest/private/qbenchmarkmetric_p.h>
#include <QtTest/qbenchmark.h>
diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h
index 1444439e11..8dbfd4b618 100644
--- a/src/testlib/qbenchmarkmeasurement_p.h
+++ b/src/testlib/qbenchmarkmeasurement_p.h
@@ -51,8 +51,6 @@
// We mean it.
//
-#include <QtCore/qelapsedtimer.h>
-#include <QtTest/private/cycle_p.h>
#include <QtTest/qbenchmark.h>
QT_BEGIN_NAMESPACE
@@ -73,40 +71,6 @@ public:
virtual QTest::QBenchmarkMetric metricType() = 0;
};
-class QBenchmarkTimeMeasurer : public QBenchmarkMeasurerBase
-{
-public:
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int sugestion);
- int adjustMedianCount(int suggestion);
- bool needsWarmupIteration();
- QTest::QBenchmarkMetric metricType();
-private:
- QElapsedTimer time;
-};
-
-#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h
-
-class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase
-{
-public:
- void start();
- qint64 checkpoint();
- qint64 stop();
- bool isMeasurementAccepted(qint64 measurement);
- int adjustIterationCount(int);
- int adjustMedianCount(int suggestion);
- bool needsWarmupIteration();
- QTest::QBenchmarkMetric metricType();
-private:
- CycleCounterTicks startTicks;
-};
-
-#endif
-
QT_END_NAMESPACE
#endif // QBENCHMARKMEASUREMENT_P_H
diff --git a/src/testlib/qbenchmarktimemeasurers_p.h b/src/testlib/qbenchmarktimemeasurers_p.h
new file mode 100644
index 0000000000..e5ffb1157d
--- /dev/null
+++ b/src/testlib/qbenchmarktimemeasurers_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtTest module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QBENCHMARKTIMEMEASURERS_P_H
+#define QBENCHMARKTIMEMEASURERS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtTest/private/qbenchmarkmeasurement_p.h>
+#include <QtCore/qelapsedtimer.h>
+#include <QtTest/private/cycle_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QBenchmarkTimeMeasurer : public QBenchmarkMeasurerBase
+{
+public:
+ void start();
+ qint64 checkpoint();
+ qint64 stop();
+ bool isMeasurementAccepted(qint64 measurement);
+ int adjustIterationCount(int sugestion);
+ int adjustMedianCount(int suggestion);
+ bool needsWarmupIteration();
+ QTest::QBenchmarkMetric metricType();
+private:
+ QElapsedTimer time;
+};
+
+#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h
+
+class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase
+{
+public:
+ void start();
+ qint64 checkpoint();
+ qint64 stop();
+ bool isMeasurementAccepted(qint64 measurement);
+ int adjustIterationCount(int);
+ int adjustMedianCount(int suggestion);
+ bool needsWarmupIteration();
+ QTest::QBenchmarkMetric metricType();
+private:
+ CycleCounterTicks startTicks;
+};
+
+#endif // HAVE_TICK_COUNTER
+
+QT_END_NAMESPACE
+
+#endif // QBENCHMARKTIMEMEASURERS_P_H
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index d76dbb8c75..5b2205e875 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -14,6 +14,7 @@ QMAKE_DOCS = $$PWD/doc/qttestlib.qdocconf
HEADERS = qbenchmark.h \
qbenchmark_p.h \
qbenchmarkmeasurement_p.h \
+ qbenchmarktimemeasurers_p.h \
qbenchmarkvalgrind_p.h \
qbenchmarkevent_p.h \
qbenchmarkperfevents_p.h \