3#include <QtCore/QElapsedTimer>
5#include <QtCore/QJsonObject>
6#include <QtCore/QObject>
7#include <QtCore/QString>
37 qint64
minTimeMs = std::numeric_limits<qint64>::max();
57 StateProfile
profile(
const QString& stateName)
const;
60 QHash<QString, StateProfile>
allProfiles()
const {
return _profiles; }
72 QJsonObject
toJson()
const;
78 void _onMachineStarted();
79 void _onMachineStopped();
80 void _onStateEntered();
81 void _onStateExited();
85 bool _enabled =
false;
87 QHash<QString, StateProfile> _profiles;
88 QElapsedTimer _machineTimer;
89 QElapsedTimer _stateTimer;
90 qint64 _totalRuntimeMs = 0;
91 int _transitionCount = 0;
93 QString _currentStateName;
94 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.
StateMachineProfiler(QGCStateMachine *machine)
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