2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2013-01-02 11:13:29 +00:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-09-19 12:28:29 +00:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the QtTest module of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
2012-09-19 12:28:29 +00:00
|
|
|
** 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 Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-04-27 10:05:43 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-05-24 09:34:08 +00:00
|
|
|
** GNU General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2012-01-24 06:17:24 +00:00
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <QtTest/private/qbenchmarkmetric_p.h>
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\enum QTest::QBenchmarkMetric
|
|
|
|
\since 4.7
|
|
|
|
|
|
|
|
This enum lists all the things that can be benchmarked.
|
2011-09-01 04:24:53 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
\value FramesPerSecond Frames per second
|
|
|
|
\value BitsPerSecond Bits per second
|
|
|
|
\value BytesPerSecond Bytes per second
|
|
|
|
\value WalltimeMilliseconds Clock time in milliseconds
|
2012-05-09 06:43:53 +00:00
|
|
|
\value WalltimeNanoseconds Clock time in nanoseconds
|
|
|
|
\value BytesAllocated Memory usage in bytes
|
2012-04-09 18:20:15 +00:00
|
|
|
\value Events Event count
|
|
|
|
\value CPUTicks CPU time
|
|
|
|
\value CPUMigrations Process migrations between CPUs
|
|
|
|
\value CPUCycles CPU cycles
|
|
|
|
\value BusCycles Bus cycles
|
|
|
|
\value StalledCycles Cycles stalled
|
|
|
|
\value InstructionReads Instruction reads
|
|
|
|
\value Instructions Instructions executed
|
|
|
|
\value BranchInstructions Branch-type instructions
|
|
|
|
\value BranchMisses Branch instructions that were mispredicted
|
|
|
|
\value CacheReferences Cache accesses of any type
|
|
|
|
\value CacheMisses Cache misses of any type
|
|
|
|
\value CacheReads Cache reads / loads
|
|
|
|
\value CacheReadMisses Cache read / load misses
|
|
|
|
\value CacheWrites Cache writes / stores
|
|
|
|
\value CacheWriteMisses Cache write / store misses
|
|
|
|
\value CachePrefetches Cache prefetches
|
|
|
|
\value CachePrefetchMisses Cache prefetch misses
|
|
|
|
\value ContextSwitches Context switches
|
|
|
|
\value PageFaults Page faults of any type
|
|
|
|
\value MinorPageFaults Minor page faults
|
|
|
|
\value MajorPageFaults Major page faults
|
|
|
|
\value AlignmentFaults Faults caused due to misalignment
|
|
|
|
\value EmulationFaults Faults that needed software emulation
|
|
|
|
|
|
|
|
\sa QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit()
|
2012-05-09 06:43:53 +00:00
|
|
|
|
|
|
|
Note that \c WalltimeNanoseconds and \c BytesAllocated are
|
|
|
|
only provided for use via \l setBenchmarkResult(), and results
|
|
|
|
in those metrics are not able to be provided automatically
|
|
|
|
by the QTest framework.
|
2011-04-27 10:05:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\relates QTest
|
|
|
|
\since 4.7
|
|
|
|
Returns the enum value \a metric as a character string.
|
|
|
|
*/
|
|
|
|
const char * QTest::benchmarkMetricName(QBenchmarkMetric metric)
|
|
|
|
{
|
|
|
|
switch (metric) {
|
|
|
|
case FramesPerSecond:
|
|
|
|
return "FramesPerSecond";
|
|
|
|
case BitsPerSecond:
|
|
|
|
return "BitsPerSecond";
|
|
|
|
case BytesPerSecond:
|
|
|
|
return "BytesPerSecond";
|
|
|
|
case WalltimeMilliseconds:
|
|
|
|
return "WalltimeMilliseconds";
|
2012-04-09 18:20:15 +00:00
|
|
|
case Events:
|
|
|
|
return "Events";
|
2011-04-27 10:05:43 +00:00
|
|
|
case CPUTicks:
|
|
|
|
return "CPUTicks";
|
2012-04-09 18:20:15 +00:00
|
|
|
case CPUMigrations:
|
|
|
|
return "CPUMigrations";
|
|
|
|
case CPUCycles:
|
|
|
|
return "CPUCycles";
|
|
|
|
case BusCycles:
|
|
|
|
return "BusCycles";
|
|
|
|
case StalledCycles:
|
|
|
|
return "StalledCycles";
|
2011-04-27 10:05:43 +00:00
|
|
|
case InstructionReads:
|
|
|
|
return "InstructionReads";
|
2012-04-09 18:20:15 +00:00
|
|
|
case Instructions:
|
|
|
|
return "Instructions";
|
2012-05-09 06:43:53 +00:00
|
|
|
case WalltimeNanoseconds:
|
|
|
|
return "WalltimeNanoseconds";
|
|
|
|
case BytesAllocated:
|
|
|
|
return "BytesAllocated";
|
2012-04-09 18:20:15 +00:00
|
|
|
case BranchInstructions:
|
|
|
|
return "BranchInstructions";
|
|
|
|
case BranchMisses:
|
|
|
|
return "BranchMisses";
|
|
|
|
case CacheReferences:
|
|
|
|
return "CacheReferences";
|
|
|
|
case CacheReads:
|
|
|
|
return "CacheReads";
|
|
|
|
case CacheWrites:
|
|
|
|
return "CacheWrites";
|
|
|
|
case CachePrefetches:
|
|
|
|
return "CachePrefetches";
|
|
|
|
case CacheMisses:
|
|
|
|
return "CacheMisses";
|
|
|
|
case CacheReadMisses:
|
|
|
|
return "CacheReadMisses";
|
|
|
|
case CacheWriteMisses:
|
|
|
|
return "CacheWriteMisses";
|
|
|
|
case CachePrefetchMisses:
|
|
|
|
return "CachePrefetchMisses";
|
|
|
|
case ContextSwitches:
|
|
|
|
return "ContextSwitches";
|
|
|
|
case PageFaults:
|
|
|
|
return "PageFaults";
|
|
|
|
case MinorPageFaults:
|
|
|
|
return "MinorPageFaults";
|
|
|
|
case MajorPageFaults:
|
|
|
|
return "MajorPageFaults";
|
|
|
|
case AlignmentFaults:
|
|
|
|
return "AlignmentFaults";
|
|
|
|
case EmulationFaults:
|
|
|
|
return "EmulationFaults";
|
2011-04-27 10:05:43 +00:00
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\relates QTest
|
|
|
|
\since 4.7
|
|
|
|
Retuns the units of measure for the specified \a metric.
|
|
|
|
*/
|
|
|
|
const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric)
|
|
|
|
{
|
|
|
|
switch (metric) {
|
|
|
|
case FramesPerSecond:
|
|
|
|
return "fps";
|
|
|
|
case BitsPerSecond:
|
|
|
|
return "bits/s";
|
|
|
|
case BytesPerSecond:
|
|
|
|
return "bytes/s";
|
|
|
|
case WalltimeMilliseconds:
|
|
|
|
return "msecs";
|
2012-04-09 18:20:15 +00:00
|
|
|
case Events:
|
|
|
|
return "events";
|
2011-04-27 10:05:43 +00:00
|
|
|
case CPUTicks:
|
|
|
|
return "CPU ticks";
|
2012-04-09 18:20:15 +00:00
|
|
|
case CPUMigrations:
|
|
|
|
return "CPU migrations";
|
|
|
|
case CPUCycles:
|
|
|
|
return "CPU cycles";
|
|
|
|
case BusCycles:
|
|
|
|
return "bus cycles";
|
|
|
|
case StalledCycles:
|
|
|
|
return "stalled cycles";
|
2011-04-27 10:05:43 +00:00
|
|
|
case InstructionReads:
|
|
|
|
return "instruction reads";
|
2012-04-09 18:20:15 +00:00
|
|
|
case Instructions:
|
|
|
|
return "instructions";
|
2012-05-09 06:43:53 +00:00
|
|
|
case WalltimeNanoseconds:
|
|
|
|
return "nsecs";
|
|
|
|
case BytesAllocated:
|
|
|
|
return "bytes";
|
2012-04-09 18:20:15 +00:00
|
|
|
case BranchInstructions:
|
|
|
|
return "branch instructions";
|
|
|
|
case BranchMisses:
|
|
|
|
return "branch misses";
|
|
|
|
case CacheReferences:
|
|
|
|
return "cache references";
|
|
|
|
case CacheReads:
|
|
|
|
return "cache loads";
|
|
|
|
case CacheWrites:
|
|
|
|
return "cache stores";
|
|
|
|
case CachePrefetches:
|
|
|
|
return "cache prefetches";
|
|
|
|
case CacheMisses:
|
|
|
|
return "cache misses";
|
|
|
|
case CacheReadMisses:
|
|
|
|
return "cache load misses";
|
|
|
|
case CacheWriteMisses:
|
|
|
|
return "cache store misses";
|
|
|
|
case CachePrefetchMisses:
|
|
|
|
return "cache prefetch misses";
|
|
|
|
case ContextSwitches:
|
|
|
|
return "context switches";
|
|
|
|
case PageFaults:
|
|
|
|
return "page faults";
|
|
|
|
case MinorPageFaults:
|
|
|
|
return "minor page faults";
|
|
|
|
case MajorPageFaults:
|
|
|
|
return "major page faults";
|
|
|
|
case AlignmentFaults:
|
|
|
|
return "alignment faults";
|
|
|
|
case EmulationFaults:
|
|
|
|
return "emulation faults";
|
2011-04-27 10:05:43 +00:00
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|