From 22dad3f83c61e34f45600af4b3b703dbe907cb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Fri, 27 Jan 2023 08:10:01 +0200 Subject: [PATCH] Trace: Convert qtcore module to use tracepointgen tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I379896280a16cd0b94d7ee9d0cfcca4afe64b9fe Reviewed-by: Hatem ElKharashy Reviewed-by: Tomi Korpipää Reviewed-by: Janne Koskinen (cherry picked from commit 4ce1c1d93252c0fbe8224faf7416b8e5a5a21d76) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/CMakeLists.txt | 10 +++++++++- src/corelib/global/qlogging.cpp | 4 ++++ src/corelib/kernel/qcoreapplication.cpp | 17 ++++++++++++++++- src/corelib/kernel/qcoreevent.cpp | 3 +++ src/corelib/kernel/qobject.cpp | 11 +++++++++++ src/corelib/plugin/qfactoryloader.cpp | 2 ++ src/corelib/plugin/qlibrary.cpp | 3 +++ 7 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 19c3b749d4d..099eb4309c9 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -1406,7 +1406,15 @@ if(APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET) endif() # special case end -qt_internal_create_tracepoints(Core qtcore.tracepoints) +qt_internal_generate_tracepoints(Core core + SOURCES + kernel/qcoreapplication.cpp + kernel/qcoreevent.cpp + kernel/qobject.cpp + plugin/qfactoryloader.cpp + plugin/qlibrary.cpp + global/qlogging.cpp +) qt_internal_add_docs(Core doc/qtcore.qdocconf ) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 213273ed67c..cf38a90151b 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -129,6 +129,10 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; +#ifndef QT_BOOTSTRAPPED +Q_TRACE_POINT(qtcore, qt_message_print, int type, const char *category, const char *function, const char *file, int line, const QString &message); +#endif + /*! \headerfile \inmodule QtCore diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 096c2b1d2e7..fbf631d85b2 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -108,6 +108,21 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; +Q_TRACE_PREFIX(qtcore, + "QT_BEGIN_NAMESPACE" \ + "class QEvent;" \ + "QT_END_NAMESPACE" +); +Q_TRACE_METADATA(qtcore, "ENUM { AUTO, RANGE User ... MaxUser } QEvent::Type;"); +Q_TRACE_POINT(qtcore, QCoreApplication_postEvent_entry, QObject *receiver, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QCoreApplication_postEvent_exit); +Q_TRACE_POINT(qtcore, QCoreApplication_postEvent_event_compressed, QObject *receiver, QEvent *event); +Q_TRACE_POINT(qtcore, QCoreApplication_postEvent_event_posted, QObject *receiver, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QCoreApplication_sendEvent, QObject *receiver, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QCoreApplication_sendSpontaneousEvent, QObject *receiver, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QCoreApplication_notify_entry, QObject *receiver, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QCoreApplication_notify_exit, bool consumed, bool filtered); + #if defined(Q_OS_WIN) || defined(Q_OS_MAC) extern QString qAppFileName(); #endif @@ -769,7 +784,7 @@ QCoreApplication::QCoreApplication(int &argc, char **argv \value ApplicationFlags QT_VERSION */ -void QCoreApplicationPrivate::init() +void Q_TRACE_INSTRUMENT(qtcore) QCoreApplicationPrivate::init() { Q_TRACE_SCOPE(QCoreApplicationPrivate_init); diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index dfc37878ed1..0f4af06363d 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -14,6 +14,9 @@ QT_BEGIN_NAMESPACE +Q_TRACE_POINT(qtcore, QEvent_ctor, QEvent *event, QEvent::Type type); +Q_TRACE_POINT(qtcore, QEvent_dtor, QEvent *event, QEvent::Type type); + /*! \class QEvent \inmodule QtCore diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 81bcf19114b..8a8ef2fd6df 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -43,6 +43,17 @@ QT_BEGIN_NAMESPACE +Q_TRACE_POINT(qtcore, QObject_ctor, QObject *object); +Q_TRACE_POINT(qtcore, QObject_dtor, QObject *object); +Q_TRACE_POINT(qtcore, QMetaObject_activate_entry, QObject *sender, int signalIndex); +Q_TRACE_POINT(qtcore, QMetaObject_activate_exit); +Q_TRACE_POINT(qtcore, QMetaObject_activate_slot_entry, QObject *receiver, int slotIndex); +Q_TRACE_POINT(qtcore, QMetaObject_activate_slot_exit); +Q_TRACE_POINT(qtcore, QMetaObject_activate_slot_functor_entry, void *slotObject); +Q_TRACE_POINT(qtcore, QMetaObject_activate_slot_functor_exit); +Q_TRACE_POINT(qtcore, QMetaObject_activate_declarative_signal_entry, QObject *sender, int signalIndex); +Q_TRACE_POINT(qtcore, QMetaObject_activate_declarative_signal_exit); + static int DIRECT_CONNECTION_ONLY = 0; Q_LOGGING_CATEGORY(lcConnectSlotsByName, "qt.core.qmetaobject.connectslotsbyname") diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index a9d62476973..1e7b54d1696 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -36,6 +36,8 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; +Q_TRACE_POINT(qtcore, QFactoryLoader_update, const QString &fileName); + bool QPluginParsedMetaData::parse(QByteArrayView raw) { QPluginMetaData::Header header; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index abfb1e0df5a..3b39e51e195 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -34,6 +34,9 @@ QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; +Q_TRACE_POINT(qtcore, QLibraryPrivate_load_entry, const QString &fileName); +Q_TRACE_POINT(qtcore, QLibraryPrivate_load_exit, bool success); + // On Unix systema and on Windows with MinGW, we can mix and match debug and // release plugins without problems. (unless compiled in debug-and-release mode // - why?)