forked from qt-creator/qt-creator
Add environment variable for internal profiling
Change-Id: Idd9197a7610aec550945fc0cb1c0a1dd833b7cba Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
#include "benchmarker.h"
|
#include "benchmarker.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
static Q_LOGGING_CATEGORY(benchmarksLog, "qtc.benchmark");
|
static Q_LOGGING_CATEGORY(benchmarksLog, "qtc.benchmark");
|
||||||
|
|
||||||
@@ -68,12 +70,16 @@ void Benchmarker::report(const QString &testsuite,
|
|||||||
void Benchmarker::report(const QLoggingCategory &cat, const QString &testsuite, const QString &testcase,
|
void Benchmarker::report(const QLoggingCategory &cat, const QString &testsuite, const QString &testcase,
|
||||||
qint64 ms, const QString &tags)
|
qint64 ms, const QString &tags)
|
||||||
{
|
{
|
||||||
|
static const QByteArray quitAfter = qgetenv("QTC_QUIT_AFTER_BENCHMARK");
|
||||||
QString t = "unit=ms";
|
QString t = "unit=ms";
|
||||||
if (!tags.isEmpty())
|
if (!tags.isEmpty())
|
||||||
t += "," + tags;
|
t += "," + tags;
|
||||||
|
|
||||||
qCDebug(cat, "%s::%s: %lld { %s }",
|
const QByteArray testSuite = testsuite.toUtf8();
|
||||||
testsuite.toUtf8().data(), testcase.toUtf8().data(), ms, t.toUtf8().data());
|
const QByteArray testCase = testcase.toUtf8();
|
||||||
|
qCDebug(cat, "%s::%s: %lld { %s }", testSuite.data(), testCase.data(), ms, t.toUtf8().data());
|
||||||
|
if (!quitAfter.isEmpty() && quitAfter == testSuite + "::" + testCase)
|
||||||
|
QTimer::singleShot(1000, qApp, &QCoreApplication::quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user