Reduce amount of tracepoints required for event tracking

Encode the consumed/filtered state in the _exit tracepoint and remove
the separate tracking of receiver event handling. Combined, this
reduces the size of the trace file.

Change-Id: Icb3cb2dd47798543905cea450046d6fad559a15b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Milian Wolff 2019-04-29 10:39:37 +02:00
parent bfe8b506c7
commit 75634c9a53
4 changed files with 20 additions and 29 deletions

View File

@ -1197,28 +1197,26 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
{
// Note: when adjusting the tracepoints in here
// consider adjusting QApplicationPrivate::notify_helper too.
Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
bool consumed = false;
bool filtered = false;
Q_TRACE_EXIT(QCoreApplication_notify_exit, consumed, filtered);
// send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self
&& receiver->d_func()->threadData->thread == mainThread()
&& QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver, event)) {
Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
return true;
filtered = true;
return filtered;
}
// send to all receiver event filters
if (sendThroughObjectEventFilters(receiver, event)) {
Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
return true;
filtered = true;
return filtered;
}
Q_TRACE(QCoreApplication_notify_before_delivery, receiver, event, event->type());
// deliver the event
const bool consumed = receiver->event(event);
Q_TRACE(QCoreApplication_notify_after_delivery, receiver, event, event->type(), consumed);
consumed = receiver->event(event);
return consumed;
}

View File

@ -24,10 +24,7 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_exit()
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)
QCoreApplication_notify_exit(bool consumed, bool filtered)
QObject_ctor(QObject *object)
QObject_dtor(QObject *object)

View File

@ -3697,14 +3697,17 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
// to the ones in QCoreApplicationPrivate::notify_helper; the reason for their
// duplication is because tracepoint symbols are not exported by QtCore.
// If you adjust the tracepoints here, consider adjusting QCoreApplicationPrivate too.
Q_TRACE_SCOPE(QApplication_notify, receiver, e, e->type());
Q_TRACE(QApplication_notify_entry, receiver, e, e->type());
bool consumed = false;
bool filtered = false;
Q_TRACE_EXIT(QApplication_notify_exit, consumed, filtered);
// send to all application event filters
if (threadRequiresCoreApplication()
&& receiver->d_func()->threadData->thread == mainThread()
&& sendThroughApplicationEventFilters(receiver, e)) {
Q_TRACE(QApplication_notify_event_filtered, receiver, e, e->type());
return true;
filtered = true;
return filtered;
}
if (receiver->isWidgetType()) {
@ -3726,16 +3729,12 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e)
// send to all receiver event filters
if (sendThroughObjectEventFilters(receiver, e)) {
Q_TRACE(QApplication_notify_event_filtered, receiver, e, e->type());
return true;
filtered = true;
return filtered;
}
Q_TRACE(QApplication_notify_before_delivery, receiver, e, e->type());
// deliver the event
const bool consumed = receiver->event(e);
Q_TRACE(QApplication_notify_after_delivery, receiver, e, e->type(), consumed);
consumed = receiver->event(e);
QCoreApplicationPrivate::setEventSpontaneous(e, false);
return consumed;

View File

@ -5,7 +5,4 @@ QT_END_NAMESPACE
}
QApplication_notify_entry(QObject *receiver, QEvent *event, int type)
QApplication_notify_exit()
QApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
QApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
QApplication_notify_exit(bool consumed, bool filtered)