Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/testlib/qbenchmark.cpp

    r2 r561  
    1 
    21/****************************************************************************
    32**
    43** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    5 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    66**
    77** This file is part of the QtTest module of the Qt Toolkit.
     
    2222** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2323**
    24 ** In addition, as a special exception, Nokia gives you certain
    25 ** additional rights. These rights are described in the Nokia Qt LGPL
    26 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    27 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2827**
    2928** GNU General Public License Usage
     
    3534** met: http://www.gnu.org/copyleft/gpl.html.
    3635**
    37 ** If you are unsure which license is appropriate for your use, please
    38 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3938** $QT_END_LICENSE$
    4039**
     
    118117
    119118QBenchmarkTestMethodData::QBenchmarkTestMethodData()
    120 :resultAccepted(false), iterationCount(-1)
     119:resultAccepted(false), runOnce(false), iterationCount(-1)
    121120{
    122121   
     
    159158        accepted = true;
    160159
     160    if (QBenchmarkTestMethodData::current->runOnce) {
     161        iterationCount = 1;
     162        accepted = true;
     163    }
     164   
    161165    // Test the result directly without calling the measurer if the minimum time
    162166    // has been specifed on the command line with -minimumvalue.
     
    176180}
    177181
    178 /*! \internal
     182/*!
     183    \class QTest::QBenchmarkIterationController
     184    \internal
     185
    179186    The QBenchmarkIterationController class is used by the QBENCHMARK macro to
    180187    drive the benchmarking loop. It is repsonsible for starting and stopping
    181188    the timing measurements as well as calling the result reporting functions.
    182189*/
     190
     191/*! \internal
     192*/
     193QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runMode)
     194{
     195    i = 0;
     196    if (runMode == RunOnce)
     197        QBenchmarkTestMethodData::current->runOnce = true;   
     198    QTest::beginBenchmarkMeasurement();
     199}
     200
    183201QTest::QBenchmarkIterationController::QBenchmarkIterationController()
    184202{
     203    i = 0;
    185204    QTest::beginBenchmarkMeasurement();
    186     i = 0;
    187 }
     205}
     206
    188207/*! \internal
    189208*/
     
    197216bool QTest::QBenchmarkIterationController::isDone()
    198217{
     218    if (QBenchmarkTestMethodData::current->runOnce)
     219        return i > 0;
    199220    return i >= QTest::iterationCount();
    200221}
     
    220241    QBenchmarkTestMethodData::current->adjustIterationCount(count);
    221242}
     243
    222244/*! \internal
    223245*/
Note: See TracChangeset for help on using the changeset viewer.