diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2019-04-29 10:39:37 +0200 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2019-05-02 14:15:58 +0000 |
commit | 75634c9a53133d03c245bbaab4b2047ff823ef03 (patch) | |
tree | 74406887d0f6df5b2f56618f75c001ce5e7f19be | |
parent | bfe8b506c7d28538430d9e036f14b074cf52762a (diff) |
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>
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 20 | ||||
-rw-r--r-- | src/corelib/qtcore.tracepoints | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 19 | ||||
-rw-r--r-- | src/widgets/qtwidgets.tracepoints | 5 |
4 files changed, 20 insertions, 29 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 596941b5a9..e5f39a8d35 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -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; } diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index a1bc957fe5..4647b440a8 100644 --- a/src/corelib/qtcore.tracepoints +++ b/src/corelib/qtcore.tracepoints @@ -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) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index fdece8414c..c3e10063e1 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -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; diff --git a/src/widgets/qtwidgets.tracepoints b/src/widgets/qtwidgets.tracepoints index b99e46e33f..b967aaf4aa 100644 --- a/src/widgets/qtwidgets.tracepoints +++ b/src/widgets/qtwidgets.tracepoints @@ -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) |