author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtTest module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
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. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "QtTest/private/qbenchmarkmeasurement_p.h" |
|
43 |
#include "QtTest/private/qbenchmark_p.h" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
44 |
#include "QtTest/private/qbenchmarkmetric_p.h" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
45 |
#include "qbenchmark.h" |
0 | 46 |
#include <qdebug.h> |
47 |
||
48 |
QT_BEGIN_NAMESPACE |
|
49 |
||
50 |
// QBenchmarkTimeMeasurer implementation |
|
51 |
||
52 |
void QBenchmarkTimeMeasurer::start() |
|
53 |
{ |
|
54 |
time.start(); |
|
55 |
} |
|
56 |
||
57 |
qint64 QBenchmarkTimeMeasurer::checkpoint() |
|
58 |
{ |
|
59 |
return time.elapsed(); |
|
60 |
} |
|
61 |
||
62 |
qint64 QBenchmarkTimeMeasurer::stop() |
|
63 |
{ |
|
64 |
return time.elapsed(); |
|
65 |
} |
|
66 |
||
67 |
bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement) |
|
68 |
{ |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
69 |
return (measurement > 50); |
0 | 70 |
} |
71 |
||
72 |
int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion) |
|
73 |
{ |
|
74 |
return suggestion; |
|
75 |
} |
|
76 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
77 |
bool QBenchmarkTimeMeasurer::needsWarmupIteration() |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
78 |
{ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
79 |
return true; |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
80 |
} |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
81 |
|
0 | 82 |
int QBenchmarkTimeMeasurer::adjustMedianCount(int) |
83 |
{ |
|
84 |
return 1; |
|
85 |
} |
|
86 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
87 |
QTest::QBenchmarkMetric QBenchmarkTimeMeasurer::metricType() |
0 | 88 |
{ |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
89 |
return QTest::WalltimeMilliseconds; |
0 | 90 |
} |
91 |
||
92 |
#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h |
|
93 |
||
94 |
void QBenchmarkTickMeasurer::start() |
|
95 |
{ |
|
96 |
startTicks = getticks(); |
|
97 |
} |
|
98 |
||
99 |
qint64 QBenchmarkTickMeasurer::checkpoint() |
|
100 |
{ |
|
101 |
CycleCounterTicks now = getticks(); |
|
102 |
return qRound64(elapsed(now, startTicks)); |
|
103 |
} |
|
104 |
||
105 |
qint64 QBenchmarkTickMeasurer::stop() |
|
106 |
{ |
|
107 |
CycleCounterTicks now = getticks(); |
|
108 |
return qRound64(elapsed(now, startTicks)); |
|
109 |
} |
|
110 |
||
111 |
bool QBenchmarkTickMeasurer::isMeasurementAccepted(qint64) |
|
112 |
{ |
|
113 |
return true; |
|
114 |
} |
|
115 |
||
116 |
int QBenchmarkTickMeasurer::adjustIterationCount(int) |
|
117 |
{ |
|
118 |
return 1; |
|
119 |
} |
|
120 |
||
121 |
int QBenchmarkTickMeasurer::adjustMedianCount(int) |
|
122 |
{ |
|
123 |
return 1; |
|
124 |
} |
|
125 |
||
126 |
bool QBenchmarkTickMeasurer::needsWarmupIteration() |
|
127 |
{ |
|
128 |
return true; |
|
129 |
} |
|
130 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
131 |
QTest::QBenchmarkMetric QBenchmarkTickMeasurer::metricType() |
0 | 132 |
{ |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
133 |
return QTest::CPUTicks; |
0 | 134 |
} |
135 |
||
136 |
#endif |
|
137 |
||
138 |
||
139 |
QT_END_NAMESPACE |