Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::anonymous_namespace{signaltrace.cpp}::Trace Class Reference

One running trace: its handlers, counts and timer. More...

Inheritance diagram for Sonde::anonymous_namespace{signaltrace.cpp}::Trace:

Public Types

using EndedCallback = std::function<void(Trace *, const TraceSummary &)>
 Called once the trace has ended, with its summary.

Public Member Functions

 Trace (TraceOptions options, EventSource *events, EndedCallback ended)
 Sets up a trace reporting to events (also its parent); connect() starts it.
void start ()
 Connects the subtree and starts the timer.
int id () const
 Trace id.
int objectCount () const
 Objects connected.
int connectionCount () const
 Signal connections made.
int otherThreadCount () const
 Objects left out because they live in another thread.
int overLimitCount () const
 Objects left out because of the limits.
bool hasEnded () const
 Whether the trace has ended.
void record (TraceHandler *handler, const QMetaMethod &signal, const QVariantList &args)
 Records one emission of signal of handler's object. Main thread only.
void scheduleRescan (QObject *object)
 Connects the children of object that aren't connected yet, once the event loop runs.
void objectDestroyed (TraceHandler *handler, QObject *object)
 Notes that the object of handler was destroyed, and drops the handler.
void end (const QString &reason)
 Ends the trace (once), giving reason in the summary.

Private Member Functions

QList< QMetaMethod > signalsToTrace (const QMetaObject *mo) const
 The signals of mo to trace: by the include and exclude patterns, without moc's clones and destroyed() (reported separately).
bool connectObject (QObject *object, int depth)
 Connects object, depth below the root, unless it is already.
void connectSubtree (QObject *object, int depth)
 Connects object and, within the depth limit, everything below it.
void rescan ()
 Connects the new children of the objects scheduleRescan() was given.
TraceSummary makeSummary (const QString &reason) const
 The summary, for the event and for signal_trace_stop.

Private Attributes

TraceOptions m_options
 What to trace.
QPointer< EventSource > m_events
 The "signals" source.
EndedCallback m_ended
 Told when the trace ends.
QHash< QObject *, TraceHandler * > m_handlers
 Handlers by traced object.
int m_connections = 0
 Signal connections made.
int m_otherThread = 0
 Objects left out: another thread.
int m_overLimit = 0
 Objects left out: the limits.
std::vector< TraceRow > m_rows
 Counts by (object, signal), in order of first emission.
QHash< std::pair< QString, QString >, int > m_rowIndex
 Index into m_rows by (object id, signature).
qint64 m_emissions = 0
 All emissions.
qint64 m_recorded = 0
 Emissions recorded as events.
qint64 m_notRecorded = 0
 Emissions past the limit, only counted.
QStringList m_destroyed
 Objects destroyed during the trace.
QList< QPointer< QObject > > m_pendingRescans
 Objects whose children to look at.
QTimer m_timer
 Ends the trace after durationMs.
QElapsedTimer m_clock
 Since the trace started.
bool m_hasEnded = false
 Whether end() ran.

Detailed Description

One running trace: its handlers, counts and timer.

Member Function Documentation

◆ connectObject()

bool Sonde::anonymous_namespace{signaltrace.cpp}::Trace::connectObject ( QObject * object,
int depth )
inlineprivate

Connects object, depth below the root, unless it is already.

Returns
Whether it is now.

◆ scheduleRescan()

void Sonde::anonymous_namespace{signaltrace.cpp}::Trace::scheduleRescan ( QObject * object)
inline

Connects the children of object that aren't connected yet, once the event loop runs.

Deferred: a child added in its constructor isn't fully constructed yet.


The documentation for this class was generated from the following file: