From 127518deda5a05fda2ce24be98aaaeb7b975f163 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 27 Mar 2019 13:56:57 +0100 Subject: Introduce Q_TRACE_SCOPE to simplify tracing of a function entry/exit Additionally, we also add a Q_TRACE_EXIT which runs a trace point when the scope is exited, leveraging qScopeGuard behind the scenes. Q_TRACE_SCOPE uses Q_TRACE_EXIT internally - the difference is that the _SCOPE version enforces the naming scheme of _entry / _exit for the tracepoints, whereas Q_TRACE_EXIT can be used generically. Change-Id: I4a2f5ea09f451fcf664d07fd493b679f7527ac06 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6d7985c91b..d173ec029b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -778,7 +778,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv void QCoreApplicationPrivate::init() { - Q_TRACE(QCoreApplicationPrivate_init_entry); + Q_TRACE_SCOPE(QCoreApplicationPrivate_init); #if defined(Q_OS_MACOS) QMacAutoReleasePool pool; @@ -883,8 +883,6 @@ void QCoreApplicationPrivate::init() #ifndef QT_NO_QOBJECT is_app_running = true; // No longer starting up. #endif - - Q_TRACE(QCoreApplicationPrivate_init_exit); } /*! -- cgit v1.2.3 From f4c41b9797f08f173049502fa7bd465cf5bde938 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 27 Mar 2019 14:00:21 +0100 Subject: Add missing _exit tracepoints for event handling This allows tools that look for matching `foo_entry/exit` pairs in the trace data to work properly. An unmatched `_entry` would otherwise confuse them, making them think that the call stack is continuously increasing. Change-Id: Idff7f587ea25c46ec86ad623cc82d503db34a194 Reviewed-by: Christoph Sterz Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index d173ec029b..596941b5a9 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1197,7 +1197,7 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event) { // Note: when adjusting the tracepoints in here // consider adjusting QApplicationPrivate::notify_helper too. - Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type()); + Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type()); // send to all application event filters (only does anything in the main thread) if (QCoreApplication::self @@ -1489,7 +1489,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event) */ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) { - Q_TRACE(QCoreApplication_postEvent_entry, receiver, event, event->type()); + Q_TRACE_SCOPE(QCoreApplication_postEvent, receiver, event, event->type()); if (receiver == 0) { qWarning("QCoreApplication::postEvent: Unexpected null receiver"); -- cgit v1.2.3