3#include <QtCore/QElapsedTimer>
5#include <QtCore/QJsonObject>
6#include <QtCore/QObject>
7#include <QtCore/QString>
36 qint64
minTimeMs = std::numeric_limits<qint64>::max();
56 StateProfile
profile(
const QString& stateName)
const;
59 QHash<QString, StateProfile>
allProfiles()
const {
return _profiles; }
71 QJsonObject
toJson()
const;
77 void _onMachineStarted();
78 void _onMachineStopped();
79 void _onStateEntered();
80 void _onStateExited();
84 bool _enabled =
false;
86 QHash<QString, StateProfile> _profiles;
87 QElapsedTimer _machineTimer;
88 QElapsedTimer _stateTimer;
89 qint64 _totalRuntimeMs = 0;
90 int _transitionCount = 0;
92 QString _currentStateName;
93 QList<QMetaObject::Connection> _stateConnections;
QGroundControl specific state machine with enhanced error handling.
QString summary() const
Get a human-readable summary.
qint64 totalRuntimeMs() const
Get total machine runtime.
void logProfile() const
Log the profile to debug output.
QJsonObject toJson() const
Export profile data as JSON.
int transitionCount() const
Get the number of state transitions.
QHash< QString, StateProfile > allProfiles() const
Get profile data for all states.
void reset()
Reset all profiling data.
StateProfile profile(const QString &stateName) const
Get profile data for a specific state.
~StateMachineProfiler() override=default
void setEnabled(bool enabled)
Enable or disable profiling.
double averageTimeMs() const