SXXXXXXX_PyBusMonitor1553/cpp/GrifoScope/QgScope/qgapplicationperformance.h
2025-12-17 07:59:30 +01:00

49 lines
1022 B
C++

#ifndef QGAPPLICATIONPERFORMANCE_H
#define QGAPPLICATIONPERFORMANCE_H
#include <QObject>
#include <QElapsedTimer>
class QgApplicationPerformance : public QObject
{
Q_OBJECT
Q_PROPERTY(unsigned long refreshRate READ refreshRate WRITE setRefreshRate)
private:
explicit QgApplicationPerformance(QObject *parent = 0);
public:
static QgApplicationPerformance& instance();
void setNetworkInterfaceIndex(unsigned int index, const QString& ipAddress=QString());
void setRefreshRate(unsigned long seconds);
unsigned long refreshRate() const;
unsigned int cpuUsage() const;
unsigned int peekCpuUsage() const;
unsigned long memoryUsageKiB() const;
unsigned long peekMemoryUsageKiB() const;
QString toString();
void reset();
signals:
void countersUpdated();
public slots:
private slots:
void updateCounters();
private:
void timerEvent(QTimerEvent* evn);
unsigned int net_index;
QElapsedTimer elapsedTimer;
};
#endif // QGAPPLICATIONPERFORMANCE_H