42 #include "QtTest/private/qbenchmark_p.h" 44 #ifdef QTESTLIB_USE_VALGRIND 46 #include "QtTest/private/qbenchmarkvalgrind_p.h" 47 #include <QtCore/qstringlist.h> 48 #include <QtCore/qcoreapplication.h> 49 #include <QtCore/qprocess.h> 50 #include <QtCore/qdir.h> 51 #include <QtCore/qset.h> 73 const int major = rx.
cap(1).
toInt(&ok);
76 const int minor = rx.
cap(2).
toInt(&ok);
91 qWarning(
"failed to run callgrind subprocess");
106 QFile file(fileName);
112 bool valSeen =
false;
114 while (!file.
atEnd()) {
116 if (rxValue.
indexIn(line) != -1) {
151 if (suffix > hiSuffix) {
152 lastFileInfo = fileInfo;
192 const QString execFile(origAppArgs.
at(0));
198 #if (defined Q_WS_QWS) 207 for (
int i = 1; i < origAppArgs.
size(); ++i) {
228 #if defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) 230 # pragma GCC diagnostic push 231 # pragma GCC diagnostic ignored "-Wunused-but-set-variable" 246 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) 248 # pragma GCC diagnostic pop 284 #endif // QTESTLIB_USE_VALGRIND static QString getNewestFileName()
The QDir class provides access to directory structures and their contents.
static bool rerunThroughCallgrind(const QStringList &origAppArgs, int &exitCode)
static qint64 extractLastResult()
#define CALLGRIND_DUMP_STATS
int exitCode() const
Returns the exit code of the last process that finished.
qlonglong toLongLong(bool *ok=0, int base=10) const
Returns the string converted to a long long using base base, which is 10 by default and must be betwe...
static QString outFileBase(qint64 pid=-1)
static QBenchmarkGlobalData * current
QString cap(int nth=0) const
Returns the text captured by the nth subexpression.
#define QT_END_NAMESPACE
This macro expands to.
char * data()
Returns a pointer to the data stored in the byte array.
The QRegExp class provides pattern matching using regular expressions.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QBenchmarkMetric
This enum lists all the things that can be benchmarked.
The QByteArray class provides an array of bytes.
QTest::QBenchmarkMetric metricType()
bool empty() const
This function is provided for STL compatibility.
QString fileName() const
Returns the name of the file, excluding the path.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static bool runCallgrindSubProcess(const QStringList &origAppArgs, int &exitCode)
The QString class provides a Unicode character string.
Q_PID pid() const
Returns the native process identifier for the running process, if available.
int adjustMedianCount(int)
#define CALLGRIND_ZERO_STATS
int adjustIterationCount(int)
QString callgrindOutFileBase
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool waitForFinished(int msecs=30000)
Blocks until the process has finished and the finished() signal has been emitted, or until msecs mill...
int indexIn(const QString &str, int offset=0, CaretMode caretMode=CaretAtZero) const
Attempts to find a match in str from position offset (0 by default).
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
Q_CORE_EXPORT void qWarning(const char *,...)
static qint64 applicationPid()
Returns the current process ID for the application.
static const char * data(const QByteArray &arr)
QFileInfoList entryInfoList(Filters filters=NoFilter, SortFlags sort=NoSort) const
Returns a list of QFileInfo objects for all the files and directories in the directory, ordered according to the name and attribute filters previously set with setNameFilters() and setFilter(), and sorted according to the flags set with setSorting().
static void dumpOutput(const QByteArray &data, FILE *fh)
static bool haveValgrind()
QByteArray readAllStandardError()
Regardless of the current read channel, this function returns all data available from the standard er...
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
The QFile class provides an interface for reading from and writing to files.
qint64 readLine(char *data, qint64 maxlen)
This function reads a line of ASCII characters from the device, up to a maximum of maxSize - 1 bytes...
int captureCount() const
Returns the number of captures contained in the regular expression.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
bool needsWarmupIteration()
static qint64 extractResult(const QString &fileName)
int size() const
Returns the number of items in the list.
bool isMeasurementAccepted(qint64 measurement)
bool remove()
Removes the file specified by fileName().
void start(const QString &program, const QStringList &arguments, OpenMode mode=ReadWrite)
Starts the given program in a new process, if none is already running, passing the command line argum...
QByteArray readAllStandardOutput()
Regardless of the current read channel, this function returns all data available from the standard ou...
bool waitForStarted(int msecs=30000)
Blocks until the process has started and the started() signal has been emitted, or until msecs millis...
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
The QFileInfo class provides system-independent file information.
bool atEnd() const
Returns true if the end of the file has been reached; otherwise returns false.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
The QProcess class is used to start external programs and to communicate with them.