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>
This commit is contained in:
parent
6a7b683817
commit
f939e7ea73
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
96
src/testlib/qbenchmarktimemeasurers_p.h
Normal file
96
src/testlib/qbenchmarktimemeasurers_p.h
Normal file
@ -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
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user