From aed3de39125896ec8a09405b7bd5b53a1406f7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Thu, 9 Mar 2023 11:21:13 +0200 Subject: [PATCH] Move CTF tracing plugin to plugins directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A coming change to support streaming requires networking so having it in corelib is dubious. Pick-to: 6.5 Change-Id: Idc25abe23b5ed07823d749294796c9f318ef1744 Reviewed-by: Hatem ElKharashy Reviewed-by: Tomi Korpipää Reviewed-by: Janne Koskinen --- src/CMakeLists.txt | 3 --- src/corelib/tracing/qctf.cpp | 2 +- src/corelib/tracing/qctf_p.h | 12 ++++++++++++ src/plugins/CMakeLists.txt | 3 +++ src/{corelib => plugins}/tracing/CMakeLists.txt | 2 +- .../tracing/metadata_template.txt | 0 src/{corelib => plugins}/tracing/qctflib.cpp | 0 src/{corelib => plugins}/tracing/qctflib_p.h | 2 +- src/{corelib => plugins}/tracing/qctfplugin.cpp | 2 +- src/{corelib => plugins}/tracing/qctfplugin_p.h | 14 ++------------ src/{corelib => plugins}/tracing/trace.json | 0 11 files changed, 21 insertions(+), 19 deletions(-) rename src/{corelib => plugins}/tracing/CMakeLists.txt (95%) rename src/{corelib => plugins}/tracing/metadata_template.txt (100%) rename src/{corelib => plugins}/tracing/qctflib.cpp (100%) rename src/{corelib => plugins}/tracing/qctflib_p.h (99%) rename src/{corelib => plugins}/tracing/qctfplugin.cpp (96%) rename src/{corelib => plugins}/tracing/qctfplugin_p.h (53%) rename src/{corelib => plugins}/tracing/trace.json (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3fd80a259d..79d313ce32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,9 +43,6 @@ endif() qt_install_3rdparty_library_wrap_config_extra_file(BundledZLIB) add_subdirectory(corelib) -if (QT_FEATURE_ctf AND QT_FEATURE_library) - add_subdirectory(corelib/tracing) -endif() # Needs to be after corelib, because some of them reference Core. add_subdirectory(3rdparty) diff --git a/src/corelib/tracing/qctf.cpp b/src/corelib/tracing/qctf.cpp index 22bb587acd..1dafa582d9 100644 --- a/src/corelib/tracing/qctf.cpp +++ b/src/corelib/tracing/qctf.cpp @@ -8,7 +8,7 @@ #include #include -#include "qctflib_p.h" +#include "qctf_p.h" QT_BEGIN_NAMESPACE diff --git a/src/corelib/tracing/qctf_p.h b/src/corelib/tracing/qctf_p.h index b2f822e337..8bd4a218c0 100644 --- a/src/corelib/tracing/qctf_p.h +++ b/src/corelib/tracing/qctf_p.h @@ -17,6 +17,7 @@ // #include +#include QT_REQUIRE_CONFIG(library); @@ -220,6 +221,17 @@ inline QByteArray toByteArrayFromFlags(QFlags value) #endif +class Q_CORE_EXPORT QCtfLib : public QObject +{ + Q_OBJECT +public: + virtual ~QCtfLib() = default; + virtual bool tracepointEnabled(const QCtfTracePointEvent &point) = 0; + virtual void doTracepoint(const QCtfTracePointEvent &point, const QByteArray &arr) = 0; + virtual bool sessionEnabled() = 0; + virtual QCtfTracePointPrivate *initializeTracepoint(const QCtfTracePointEvent &point) = 0; +}; + QT_END_NAMESPACE #endif diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 308aa800bd..dc7c45c2d8 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -25,3 +25,6 @@ if (TARGET Qt::Network) add_subdirectory(networkinformation) add_subdirectory(tls) endif() +if (QT_FEATURE_ctf AND QT_FEATURE_library) + add_subdirectory(tracing) +endif() diff --git a/src/corelib/tracing/CMakeLists.txt b/src/plugins/tracing/CMakeLists.txt similarity index 95% rename from src/corelib/tracing/CMakeLists.txt rename to src/plugins/tracing/CMakeLists.txt index c872360978..9840b59ecd 100644 --- a/src/corelib/tracing/CMakeLists.txt +++ b/src/plugins/tracing/CMakeLists.txt @@ -18,6 +18,6 @@ qt_internal_add_plugin(QCtfTracePlugin SOURCES qctflib_p.h qctflib.cpp metadata_template.txt qctfplugin.cpp qctfplugin_p.h LIBRARIES - Qt6::Core + Qt6::Core Qt6::CorePrivate ) diff --git a/src/corelib/tracing/metadata_template.txt b/src/plugins/tracing/metadata_template.txt similarity index 100% rename from src/corelib/tracing/metadata_template.txt rename to src/plugins/tracing/metadata_template.txt diff --git a/src/corelib/tracing/qctflib.cpp b/src/plugins/tracing/qctflib.cpp similarity index 100% rename from src/corelib/tracing/qctflib.cpp rename to src/plugins/tracing/qctflib.cpp diff --git a/src/corelib/tracing/qctflib_p.h b/src/plugins/tracing/qctflib_p.h similarity index 99% rename from src/corelib/tracing/qctflib_p.h rename to src/plugins/tracing/qctflib_p.h index 4ad386e209..081dda1d04 100644 --- a/src/corelib/tracing/qctflib_p.h +++ b/src/plugins/tracing/qctflib_p.h @@ -16,7 +16,7 @@ // // -#include "qctf_p.h" +#include #include "qctfplugin_p.h" #include #include diff --git a/src/corelib/tracing/qctfplugin.cpp b/src/plugins/tracing/qctfplugin.cpp similarity index 96% rename from src/corelib/tracing/qctfplugin.cpp rename to src/plugins/tracing/qctfplugin.cpp index db052fa6e0..8f2245bb28 100644 --- a/src/corelib/tracing/qctfplugin.cpp +++ b/src/plugins/tracing/qctfplugin.cpp @@ -8,7 +8,7 @@ QT_BEGIN_NAMESPACE -class QCtfTracePlugin : public QObject, public QCtfLib +class QCtfTracePlugin : public QCtfLib { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QCtfLib" FILE "trace.json") diff --git a/src/corelib/tracing/qctfplugin_p.h b/src/plugins/tracing/qctfplugin_p.h similarity index 53% rename from src/corelib/tracing/qctfplugin_p.h rename to src/plugins/tracing/qctfplugin_p.h index d09e0404e4..987c4d925f 100644 --- a/src/corelib/tracing/qctfplugin_p.h +++ b/src/plugins/tracing/qctfplugin_p.h @@ -16,22 +16,12 @@ // // -#include "qctf_p.h" +#include #include QT_BEGIN_NAMESPACE -class QCtfLib -{ -public: - virtual ~QCtfLib() = default; - virtual bool tracepointEnabled(const QCtfTracePointEvent &point) = 0; - virtual void doTracepoint(const QCtfTracePointEvent &point, const QByteArray &arr) = 0; - virtual bool sessionEnabled() = 0; - virtual QCtfTracePointPrivate *initializeTracepoint(const QCtfTracePointEvent &point) = 0; -}; - -Q_DECLARE_INTERFACE(QCtfLib, "org.qt-project.Qt.QCtfLib"); +Q_DECLARE_INTERFACE(QCtfLib, "org.qt-project.Qt.QCtfLib") QT_END_NAMESPACE diff --git a/src/corelib/tracing/trace.json b/src/plugins/tracing/trace.json similarity index 100% rename from src/corelib/tracing/trace.json rename to src/plugins/tracing/trace.json