qbenchmarkmeasurement.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/testlib/qbenchmarkmeasurement.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtTest module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include <QtTest/private/qbenchmarkmeasurement_p.h>-
35#include <QtTest/private/qbenchmark_p.h>-
36#include <QtTest/private/qbenchmarkmetric_p.h>-
37#include <QtTest/qbenchmark.h>-
38#include <qdebug.h>-
39-
40QT_BEGIN_NAMESPACE-
41-
42// QBenchmarkTimeMeasurer implementation-
43-
44void QBenchmarkTimeMeasurer::start()-
45{-
46 time.start();-
47}
executed 16 times by 1 test: end of block
Executed by:
  • tst_QByteDataBuffer
16
48-
49qint64 QBenchmarkTimeMeasurer::checkpoint()-
50{-
51 return time.elapsed();
never executed: return time.elapsed();
0
52}-
53-
54qint64 QBenchmarkTimeMeasurer::stop()-
55{-
56 return time.elapsed();
executed 16 times by 1 test: return time.elapsed();
Executed by:
  • tst_QByteDataBuffer
16
57}-
58-
59bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement)-
60{-
61 return (measurement > 50);
never executed: return (measurement > 50);
0
62}-
63-
64int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion)-
65{-
66 return suggestion;
executed 130051 times by 535 tests: return suggestion;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
130051
67}-
68-
69bool QBenchmarkTimeMeasurer::needsWarmupIteration()-
70{-
71 return true;
executed 130043 times by 535 tests: return true;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
130043
72}-
73-
74int QBenchmarkTimeMeasurer::adjustMedianCount(int)-
75{-
76 return 1;
executed 16 times by 1 test: return 1;
Executed by:
  • tst_QByteDataBuffer
16
77}-
78-
79QTest::QBenchmarkMetric QBenchmarkTimeMeasurer::metricType()-
80{-
81 return QTest::WalltimeMilliseconds;
executed 16 times by 1 test: return QTest::WalltimeMilliseconds;
Executed by:
  • tst_QByteDataBuffer
16
82}-
83-
84#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h-
85-
86void QBenchmarkTickMeasurer::start()-
87{-
88 startTicks = getticks();-
89}
never executed: end of block
0
90-
91qint64 QBenchmarkTickMeasurer::checkpoint()-
92{-
93 CycleCounterTicks now = getticks();-
94 return qRound64(elapsed(now, startTicks));
never executed: return qRound64(elapsed(now, startTicks));
0
95}-
96-
97qint64 QBenchmarkTickMeasurer::stop()-
98{-
99 CycleCounterTicks now = getticks();-
100 return qRound64(elapsed(now, startTicks));
never executed: return qRound64(elapsed(now, startTicks));
0
101}-
102-
103bool QBenchmarkTickMeasurer::isMeasurementAccepted(qint64)-
104{-
105 return true;
never executed: return true;
0
106}-
107-
108int QBenchmarkTickMeasurer::adjustIterationCount(int)-
109{-
110 return 1;
never executed: return 1;
0
111}-
112-
113int QBenchmarkTickMeasurer::adjustMedianCount(int)-
114{-
115 return 1;
never executed: return 1;
0
116}-
117-
118bool QBenchmarkTickMeasurer::needsWarmupIteration()-
119{-
120 return true;
never executed: return true;
0
121}-
122-
123QTest::QBenchmarkMetric QBenchmarkTickMeasurer::metricType()-
124{-
125 return QTest::CPUTicks;
never executed: return QTest::CPUTicks;
0
126}-
127-
128#endif-
129-
130-
131QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9