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/gui/kernel/qguiapplication.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fd01f8bb7b..424af20f26 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1421,7 +1421,7 @@ void QGuiApplicationPrivate::eventDispatcherReady() void QGuiApplicationPrivate::init() { - Q_TRACE(QGuiApplicationPrivate_init_entry); + Q_TRACE_SCOPE(QGuiApplicationPrivate_init); #if defined(Q_OS_MACOS) QMacAutoReleasePool pool; @@ -1585,8 +1585,6 @@ void QGuiApplicationPrivate::init() if (!QGuiApplicationPrivate::displayName) QObject::connect(q, &QGuiApplication::applicationNameChanged, q, &QGuiApplication::applicationDisplayNameChanged); - - Q_TRACE(QGuiApplicationPrivate_init_exit); } extern void qt_cleanupFontDatabase(); @@ -1830,7 +1828,7 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) { - Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_entry, e->type); + Q_TRACE_SCOPE(QGuiApplicationPrivate_processWindowSystemEvent, e->type); switch(e->type) { case QWindowSystemInterfacePrivate::Mouse: @@ -1940,8 +1938,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv qWarning() << "Unknown user input event type:" << e->type; break; } - - Q_TRACE(QGuiApplicationPrivate_processWindowSystemEvent_exit, e->type); } /*! \internal -- cgit v1.2.3