diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-12-05 10:33:32 +0000 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2019-12-13 15:36:59 +0000 |
commit | ef886f79f99cdae94da8bf5a4ca6e94164d56677 (patch) | |
tree | 98caf12195cb24763292305326d40c6838066312 /src/core/jobs/qaspectjob_p.h | |
parent | 6e448dd5918c70ddfd0d52f62522fa49c02e8ba8 (diff) |
Make tracing a runtime option
- Moved most of the code QSystemInformationService (private class
for now)
- Tracing can be enabled by setting QT3D_TRACE_ENABLED or
calling QSystemInformationService::setTraceEnabled(bool)
- Introduced QTaskLogger class to easy logging (RAII)
Change-Id: I2a3e08e4371fcee3e9ef3cf575725f13f57d1a94
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/jobs/qaspectjob_p.h')
-rw-r--r-- | src/core/jobs/qaspectjob_p.h | 67 |
1 files changed, 7 insertions, 60 deletions
diff --git a/src/core/jobs/qaspectjob_p.h b/src/core/jobs/qaspectjob_p.h index b16c3cad2..ddad09c86 100644 --- a/src/core/jobs/qaspectjob_p.h +++ b/src/core/jobs/qaspectjob_p.h @@ -54,6 +54,7 @@ #include <QtCore/QWeakPointer> #include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/private/qsysteminformationservice_p_p.h> #include <Qt3DCore/qt3dcore-config.h> QT_BEGIN_NAMESPACE @@ -63,47 +64,6 @@ namespace Qt3DCore { class QAspectJob; class QAspectManager; -#if QT_CONFIG(qt3d_profile_jobs) -struct FrameHeader -{ - FrameHeader() - : frameId(0) - , jobCount(0) - , frameType(WorkerJob) - { - } - - enum FrameType { - WorkerJob = 0, - Submission - }; - - quint32 frameId; - quint16 jobCount; - quint16 frameType; // Submission or worker job -}; - -union JobId -{ - quint32 typeAndInstance[2]; - quint64 id; -}; - -struct JobRunStats -{ - JobRunStats() - { - jobId.id = 0; - } - - qint64 startTime; - qint64 endTime; - JobId jobId; - // QAspectJob subclasses should properly populate the jobId - quint64 threadId; -}; -#endif - class Q_3DCORE_PRIVATE_EXPORT QAspectJobPrivate { public: @@ -115,29 +75,16 @@ public: virtual void postFrame(QAspectManager *aspectManager); QVector<QWeakPointer<QAspectJob> > m_dependencies; -#if QT_CONFIG(qt3d_profile_jobs) - JobRunStats m_stats; -#endif + JobId m_jobId; }; - } // Qt3D -#if QT_CONFIG(qt3d_profile_jobs) - -#include <Qt3DCore/private/qaspectjob_p.h> - #define SET_JOB_RUN_STAT_TYPE(job, type, instance) \ - Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[0] = type; \ - Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[1] = instance; - -#else - -#define SET_JOB_RUN_STAT_TYPE(job, type, instance) \ - Q_UNUSED(job) \ - Q_UNUSED(type) \ - Q_UNUSED(instance) - -#endif + { \ + auto &jobId = Qt3DCore::QAspectJobPrivate::get(job)->m_jobId; \ + jobId.typeAndInstance[0] = type; \ + jobId.typeAndInstance[1] = instance; \ + } QT_END_NAMESPACE |