summaryrefslogtreecommitdiffstats
path: root/src/core/jobs/qthreadpooler.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-03-23 17:06:33 +0100
committerPaul Lemire <paul.lemire@kdab.com>2017-03-28 08:05:41 +0000
commit9d85957cda4b5d90c3ce7937cc93f3be1a788383 (patch)
tree13da3f86a4c56c6b8ded8d2e39b5255378f75b4e /src/core/jobs/qthreadpooler.cpp
parent128a9550a587cb8c8a57a565f18f95c13a2d5207 (diff)
QThreadPooler: improve job traces name
And save the trace in the Download folder on Android, otherwise it's impossible to retrieve the trace on non rooted devices. Change-Id: Icc6f11429738350df26081003d9bc51233521668 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/jobs/qthreadpooler.cpp')
-rw-r--r--src/core/jobs/qthreadpooler.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 0fd08430e..8cfafafae 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -39,13 +39,16 @@
#include "qthreadpooler_p.h"
#include "dependencyhandler_p.h"
-
+#include <Qt3DCore/qt3dcore-config.h>
#include <QDebug>
#ifdef QT3D_JOBS_RUN_STATS
#include <QFile>
#include <QThreadStorage>
#include <QDateTime>
+#include <QStandardPaths>
+#include <QSysInfo>
+#include <QCoreApplication>
#endif
QT_BEGIN_NAMESPACE
@@ -197,7 +200,12 @@ void QThreadPooler::writeFrameJobLogStats()
static QScopedPointer<QFile> traceFile;
static quint32 frameId = 0;
if (!traceFile) {
- traceFile.reset(new QFile(QStringLiteral("trace_") + QDateTime::currentDateTime().toString() + QStringLiteral(".qt3d")));
+ const QString fileName = QStringLiteral("trace_") + QCoreApplication::applicationName() + QDateTime::currentDateTime().toString(QStringLiteral("_ddd_dd_MM_yy-hh_mm_ss_"))+ QSysInfo::productType() + QStringLiteral("_") + QSysInfo::buildAbi() + QStringLiteral(".qt3d");
+#ifdef Q_OS_ANDROID
+ traceFile.reset(new QFile(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/") + fileName));
+#else
+ traceFile.reset(new QFile(fileName));
+#endif
if (!traceFile->open(QFile::WriteOnly|QFile::Truncate))
qCritical("Failed to open trace file");
}