From f939e7ea7375dbc051c81abf7b24c6fd5304cbbb Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 13 Oct 2016 09:18:05 +0200 Subject: 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 Reviewed-by: Lars Knoll --- src/testlib/qbenchmarktimemeasurers_p.h | 96 +++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/testlib/qbenchmarktimemeasurers_p.h (limited to 'src/testlib/qbenchmarktimemeasurers_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 +#include +#include + +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 -- cgit v1.2.3