summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-07-27 07:31:02 +0200
committerPaul Lemire <paul.lemire@kdab.com>2017-08-03 14:44:28 +0000
commit481fd0aab96cc27f689f4ba8d98a89e541631675 (patch)
treefa85045b2436003c0d73d2e8fdfdea5af5271aba /src/core
parentafd242a810612341a37d496007ad79317d2efbea (diff)
Properly use QT_CONFIG for Qt3D profiling options
Change-Id: Id3bb7bb657f3d48c6c4cd3d5e86c43ad64dca791 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/aspects/qaspectengine.cpp10
-rw-r--r--src/core/aspects/qaspectengine_p.h10
-rw-r--r--src/core/aspects/qaspectmanager.cpp4
-rw-r--r--src/core/configure.json10
-rw-r--r--src/core/jobs/qaspectjob_p.h6
-rw-r--r--src/core/jobs/qaspectjobmanager.cpp2
-rw-r--r--src/core/jobs/qthreadpooler.cpp10
-rw-r--r--src/core/jobs/qthreadpooler_p.h4
-rw-r--r--src/core/jobs/task.cpp4
-rw-r--r--src/core/qt3dcore_global_p.h1
10 files changed, 28 insertions, 33 deletions
diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp
index ef4faa4bd..1467f0cff 100644
--- a/src/core/aspects/qaspectengine.cpp
+++ b/src/core/aspects/qaspectengine.cpp
@@ -59,7 +59,7 @@
#include <Qt3DCore/private/qservicelocator_p.h>
#include <Qt3DCore/qt3dcore-config.h>
-#if defined(QT3D_JOBS_RUN_STATS)
+#if QT_CONFIG(qt3d_profile_jobs)
#include <Qt3DCore/private/aspectcommanddebugger_p.h>
#endif
@@ -77,9 +77,9 @@ QAspectEnginePrivate::QAspectEnginePrivate()
, m_postman(nullptr)
, m_scene(nullptr)
, m_initialized(false)
- #ifdef QT3D_JOBS_RUN_STATS
+ #if QT_CONFIG(qt3d_profile_jobs)
, m_commandDebugger(new Debug::AspectCommandDebugger(q_func()))
- #endif // QT3D_JOBS_RUN_STATS
+ #endif
{
qRegisterMetaType<Qt3DCore::QAbstractAspect *>();
qRegisterMetaType<Qt3DCore::QObserverInterface *>();
@@ -235,10 +235,10 @@ void QAspectEnginePrivate::initialize()
"setScene",
Q_ARG(Qt3DCore::QScene*, m_scene));
m_initialized = true;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
m_commandDebugger->setAspectEngine(q_func());
m_commandDebugger->initialize();
-#endif // QT3D_JOBS_RUN_STATS
+#endif
}
/*!
diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h
index a7311d054..6b0aae9cb 100644
--- a/src/core/aspects/qaspectengine_p.h
+++ b/src/core/aspects/qaspectengine_p.h
@@ -51,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qt3dcore-config.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
#include <Qt3DCore/qnodecreatedchange.h>
#include <QtCore/qsharedpointer.h>
@@ -69,11 +69,11 @@ class QAspectThread;
class QPostman;
class QScene;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
namespace Debug {
class AspectCommandDebugger;
} // Debug
-#endif // QT3D_JOBS_RUN_STATS
+#endif
class QT3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate
{
@@ -92,9 +92,9 @@ public:
QHash<QString, QAbstractAspect *> m_namedAspects;
bool m_initialized;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
Debug::AspectCommandDebugger *m_commandDebugger;
-#endif // QT3D_JOBS_RUN_STATS
+#endif
void initialize();
void shutdown();
diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp
index 5ccc89b9e..e2f0d9383 100644
--- a/src/core/aspects/qaspectmanager.cpp
+++ b/src/core/aspects/qaspectmanager.cpp
@@ -289,7 +289,7 @@ void QAspectManager::exec()
//
// Doing this as the first call in the new frame ensures the lock free approach works
// without any such data race.
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
const quint32 arbiterId = 4096;
JobRunStats changeArbiterStats;
changeArbiterStats.jobId.typeAndInstance[0] = arbiterId;
@@ -298,7 +298,7 @@ void QAspectManager::exec()
changeArbiterStats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
#endif
m_changeArbiter->syncChanges();
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
changeArbiterStats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
QThreadPooler::addJobLogStatsEntry(changeArbiterStats);
#endif
diff --git a/src/core/configure.json b/src/core/configure.json
index 1640ec25a..8e1b4deeb 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -41,18 +41,12 @@
"qt3d-profile-jobs": {
"label": "Output Qt3D Job traces",
"autoDetect": false,
- "output": [
- "privateFeature",
- { "type": "define", "name": "QT3D_JOBS_RUN_STATS", "value": 1 }
- ]
+ "output": [ "privateFeature" ]
},
"qt3d-profile-gl": {
"label": "Output Qt3D GL traces",
"autoDetect": false,
- "output": [
- "privateFeature",
- { "type": "define", "name": "QT3D_OPENGL_RUN_STATS", "value": 1 }
- ]
+ "output": [ "privateFeature" ]
},
"qt3d-render": {
"label": "Render aspect",
diff --git a/src/core/jobs/qaspectjob_p.h b/src/core/jobs/qaspectjob_p.h
index 6786ccef7..ff708443e 100644
--- a/src/core/jobs/qaspectjob_p.h
+++ b/src/core/jobs/qaspectjob_p.h
@@ -62,7 +62,7 @@ namespace Qt3DCore {
class QAspectJob;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
struct FrameHeader
{
FrameHeader()
@@ -111,14 +111,14 @@ public:
static QAspectJobPrivate *get(QAspectJob *job);
QVector<QWeakPointer<QAspectJob> > m_dependencies;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
JobRunStats m_stats;
#endif
};
} // Qt3D
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
#include <Qt3DCore/private/qaspectjob_p.h>
diff --git a/src/core/jobs/qaspectjobmanager.cpp b/src/core/jobs/qaspectjobmanager.cpp
index 468d904b4..e543b60a2 100644
--- a/src/core/jobs/qaspectjobmanager.cpp
+++ b/src/core/jobs/qaspectjobmanager.cpp
@@ -102,7 +102,7 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
}
}
m_dependencyHandler->addDependencies(qMove(dependencyList));
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
QThreadPooler::writeFrameJobLogStats();
#endif
m_threadPooler->mapDependables(taskList);
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 26372ada1..2e5788b89 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -38,10 +38,10 @@
****************************************************************************/
#include "qthreadpooler_p.h"
-#include <Qt3DCore/qt3dcore-config.h>
#include <QtCore/QDebug>
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
+#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QThreadStorage>
#include <QtCore/QDateTime>
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
QElapsedTimer QThreadPooler::m_jobsStatTimer;
#endif
@@ -73,7 +73,7 @@ QThreadPooler::QThreadPooler(QObject *parent)
}
// Ensures that threads will never be recycled
m_threadPool.setExpiryTimeout(-1);
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
QThreadPooler::m_jobsStatTimer.start();
#endif
}
@@ -178,7 +178,7 @@ int QThreadPooler::maxThreadCount() const
return m_threadPool.maxThreadCount();
}
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
QThreadStorage<QVector<JobRunStats> *> jobStatsCached;
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 9d632a696..5a2104cdd 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -61,7 +61,7 @@
#include <Qt3DCore/private/qaspectjob_p.h>
#include <Qt3DCore/private/task_p.h>
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
#include <QtCore/QElapsedTimer>
#endif
@@ -84,7 +84,7 @@ public:
void setDependencyHandler(DependencyHandler *handler);
int maxThreadCount() const;
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
static QElapsedTimer m_jobsStatTimer;
// Aspects + Job threads
diff --git a/src/core/jobs/task.cpp b/src/core/jobs/task.cpp
index ca3c8b65a..cbaa993b1 100644
--- a/src/core/jobs/task.cpp
+++ b/src/core/jobs/task.cpp
@@ -70,7 +70,7 @@ AspectTaskRunnable::~AspectTaskRunnable()
void AspectTaskRunnable::run()
{
if (m_job) {
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
QAspectJobPrivate *jobD = QAspectJobPrivate::get(m_job.data());
if (m_pooler) {
jobD->m_stats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
@@ -78,7 +78,7 @@ void AspectTaskRunnable::run()
}
#endif
m_job->run();
-#ifdef QT3D_JOBS_RUN_STATS
+#if QT_CONFIG(qt3d_profile_jobs)
if (m_pooler) {
jobD->m_stats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
// Add current job's stats to log output
diff --git a/src/core/qt3dcore_global_p.h b/src/core/qt3dcore_global_p.h
index e872844d7..2d6793744 100644
--- a/src/core/qt3dcore_global_p.h
+++ b/src/core/qt3dcore_global_p.h
@@ -52,6 +52,7 @@
//
#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/private/qt3dcore-config_p.h>
#define QT3DCORE_PRIVATE_EXPORT QT3DCORESHARED_EXPORT