summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2018-06-18 17:46:44 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2018-07-04 23:24:38 +0000
commit5e5072c654d4ce8d30ce7c116639a71e610fdb78 (patch)
tree2ee99413a815b203cb988a672006ab4800d81f38
parent222e85d43431aa4c4e04f6ea4e942baf23a26cb5 (diff)
Tracepoints: trace QObject construction and destruction
Change-Id: I10f5ef391a2d3059ed5e8a26afe5e191adc31e85 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/corelib/qtcore.tracepoints3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 5387d549c6..2dcfa33629 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -64,6 +64,7 @@
#include <private/qorderedmutexlocker_p.h>
#include <private/qhooks_p.h>
+#include <qtcore_tracepoints_p.h>
#include <new>
@@ -820,6 +821,7 @@ QObject::QObject(QObject *parent)
#endif
if (Q_UNLIKELY(qtHookData[QHooks::AddQObject]))
reinterpret_cast<QHooks::AddQObjectCallback>(qtHookData[QHooks::AddQObject])(this);
+ Q_TRACE(QObject_ctor, this);
}
/*!
@@ -855,6 +857,7 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
#endif
if (Q_UNLIKELY(qtHookData[QHooks::AddQObject]))
reinterpret_cast<QHooks::AddQObjectCallback>(qtHookData[QHooks::AddQObject])(this);
+ Q_TRACE(QObject_ctor, this);
}
/*!
@@ -1030,6 +1033,8 @@ QObject::~QObject()
if (Q_UNLIKELY(qtHookData[QHooks::RemoveQObject]))
reinterpret_cast<QHooks::RemoveQObjectCallback>(qtHookData[QHooks::RemoveQObject])(this);
+ Q_TRACE(QObject_dtor, this);
+
if (d->parent) // remove it from parent object
d->setParent_helper(0);
}
diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints
index 391e4087e5..2e78490ab5 100644
--- a/src/corelib/qtcore.tracepoints
+++ b/src/corelib/qtcore.tracepoints
@@ -20,3 +20,6 @@ QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
+
+QObject_ctor(QObject *object)
+QObject_dtor(QObject *object)