diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-04-09 11:37:25 -0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-06 21:50:28 +0100 |
commit | 9d72259f943a3b31fa4e32aeb1c5a2de3d8ca611 (patch) | |
tree | bbe81012555fc1829592d66c186a2422321b60d0 /src/testlib/qtestcase.cpp | |
parent | 24f059eed0be5b901bbb81ce921a942ca785fe1d (diff) |
Add the skeleton Linux perf events counter for QtTest
Currently, it only prints "perf available" if you use the -perf option
and perf is available. The implementation comes in the next commits.
Change-Id: Ic6cdee70e21df25780799a4bc31ca2c2d923b9f8
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index ef8ffa570b..20d06f6be2 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1341,6 +1341,9 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) #ifdef QTESTLIB_USE_VALGRIND " -callgrind : Use callgrind to time benchmarks\n" #endif +#ifdef QTESTLIB_USE_PERF_EVENTS + " -perf : Use Linux perf events to time benchmarks\n" +#endif #ifdef HAVE_TICK_COUNTER " -tickcounter : Use CPU tick counters to time benchmarks\n" #endif @@ -1481,6 +1484,14 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) QBenchmarkGlobalData::current->callgrindOutFileBase = QBenchmarkValgrindUtils::outFileBase(); #endif +#ifdef QTESTLIB_USE_PERF_EVENTS + } else if (strcmp(argv[i], "-perf") == 0) { + if (QBenchmarkPerfEventsMeasurer::isAvailable()) { + printf("perf available\n"); + } else { + fprintf(stderr, "WARNING: Linux perf events not available. Using the walltime measurer.\n"); + } +#endif #ifdef HAVE_TICK_COUNTER } else if (strcmp(argv[i], "-tickcounter") == 0) { QBenchmarkGlobalData::current->setMode(QBenchmarkGlobalData::TickCounter); |