Hi Olivier Thanks for fast response.
Sorry for asking trivial questions but I didn’t quite understand about “redeclaring” things in my project. As far as I understand all I need to do is pass an instance of [QSignalSpyCallbackSet] struct with my custom callbacks to [qt_register_signal_spy_callbacks], isn’t it? Can you please clarify “redeclaring”? Thanks, Taras > On Aug 8, 2018, at 08:15, Olivier Goffart <[email protected]> wrote: > > On 2018-08-08 06:53, Taras Kushnir wrote: >> Hello >> I’ve been refactoring giant pieces (like 50-60%) of one project's codebase >> and I’m concerned about validity/quality of the result. Except different >> kinds of tests I’m thinking about statistical metrics one of which would be >> to get a feel how Qt-specific parts of the project have changes. >> Is there any way to produce statistics which signals got fired and how many >> times (+ the same for slots) automatically during any application runtime? >> (“any" way except of patching and recompiling Qt framework itself) > > > There is a way: > There is some exported private API from qobject_p.h that you can trivially > re-declare in your project: > > > struct QSignalSpyCallbackSet > { > typedef void (*BeginCallback)(QObject *caller, int signal_or_method_index, > void **argv); > typedef void (*EndCallback)(QObject *caller, int signal_or_method_index); > BeginCallback signal_begin_callback, > slot_begin_callback; > EndCallback signal_end_callback, > slot_end_callback; > }; > void Q_CORE_EXPORT qt_register_signal_spy_callbacks(const > QSignalSpyCallbackSet &callback_set); > > extern QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set; > > https://code.woboq.org/qt5/qtbase/src/corelib/kernel/qobject_p.h.html#73 > > > All you need to do is to call qt_register_signal_spy_callbacks to register > the signal_begin_callback, and this will be called everytime a signal is > emited. So you can gather some statistics from that. > > > -- > Olivier > > Woboq - Qt services and support - https://woboq.com - https://code.woboq.org > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
