Tracepoints: trace signal activation

Change-Id: I1ef8074178386166157d9b3416fd432014585857
Reviewed-by: Rafael Roquetto <rafael@roquetto.com>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
This commit is contained in:
Giuseppe D'Angelo 2018-06-18 17:54:49 +02:00
parent 80406d2c25
commit 42c545faf7
2 changed files with 23 additions and 2 deletions

View File

@ -3652,13 +3652,17 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
if (sender->d_func()->isDeclarativeSignalConnected(signal_index) if (sender->d_func()->isDeclarativeSignalConnected(signal_index)
&& QAbstractDeclarativeData::signalEmitted) { && QAbstractDeclarativeData::signalEmitted) {
Q_TRACE(QMetaObject_activate_begin_declarative_signal, sender, signal_index);
QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender, QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender,
signal_index, argv); signal_index, argv);
Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index);
} }
if (!sender->d_func()->isSignalConnected(signal_index, /*checkDeclarative =*/ false) if (!sender->d_func()->isSignalConnected(signal_index, /*checkDeclarative =*/ false)
&& !qt_signal_spy_callback_set.signal_begin_callback && !qt_signal_spy_callback_set.signal_begin_callback
&& !qt_signal_spy_callback_set.signal_end_callback) { && !qt_signal_spy_callback_set.signal_end_callback
&& !Q_TRACE_ENABLED(QMetaObject_activate_begin_signal)
&& !Q_TRACE_ENABLED(QMetaObject_activate_end_signal)) {
// The possible declarative connection is done, and nothing else is connected, so: // The possible declarative connection is done, and nothing else is connected, so:
return; return;
} }
@ -3668,6 +3672,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index, qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index,
argv ? argv : empty_argv); argv ? argv : empty_argv);
} }
Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
{ {
QMutexLocker locker(signalSlotLock(sender)); QMutexLocker locker(signalSlotLock(sender));
@ -3698,6 +3703,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
locker.unlock(); locker.unlock();
if (qt_signal_spy_callback_set.signal_end_callback != 0) if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); qt_signal_spy_callback_set.signal_end_callback(sender, signal_index);
Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
return; return;
} }
@ -3758,7 +3764,9 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
c->slotObj->ref(); c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj); QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
locker.unlock(); locker.unlock();
Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
obj->call(receiver, argv ? argv : empty_argv); obj->call(receiver, argv ? argv : empty_argv);
Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
// Make sure the slot object gets destroyed before the mutex is locked again, as the // Make sure the slot object gets destroyed before the mutex is locked again, as the
// destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool, // destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool,
@ -3774,9 +3782,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
locker.unlock(); locker.unlock();
if (qt_signal_spy_callback_set.slot_begin_callback != 0) if (qt_signal_spy_callback_set.slot_begin_callback != 0)
qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv); qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex);
callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
if (qt_signal_spy_callback_set.slot_end_callback != 0) if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex);
locker.relock(); locker.relock();
@ -3789,9 +3799,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
method, method,
argv ? argv : empty_argv); argv ? argv : empty_argv);
} }
Q_TRACE(QMetaObject_activate_begin_slot, receiver, method);
metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv);
Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
if (qt_signal_spy_callback_set.slot_end_callback != 0) if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, method); qt_signal_spy_callback_set.slot_end_callback(receiver, method);
@ -3812,7 +3824,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
if (qt_signal_spy_callback_set.signal_end_callback != 0) if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); qt_signal_spy_callback_set.signal_end_callback(sender, signal_index);
Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
} }
/*! /*!

View File

@ -23,3 +23,12 @@ QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int typ
QObject_ctor(QObject *object) QObject_ctor(QObject *object)
QObject_dtor(QObject *object) QObject_dtor(QObject *object)
QMetaObject_activate_begin_signal(QObject *sender, int signalIndex)
QMetaObject_activate_end_signal(QObject *sender, int signalIndex)
QMetaObject_activate_begin_slot(QObject *receiver, int slotIndex)
QMetaObject_activate_end_slot(QObject *receiver, int slotIndex)
QMetaObject_activate_begin_slot_functor(void *slotObject)
QMetaObject_activate_end_slot_functor(void *slotObject)
QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)