玉兔远程控制 0.1.0-alpha.2
载入中...
搜索中...
未找到
Stats.h
1// Author: Kang Lin <kl222@126.com>
2
3#pragma once
4
5#include <QAtomicInteger>
6#include <QAtomicInt>
7#include <QDateTime>
8#include "ParameterOperate.h"
9
10class PLUGIN_EXPORT CStats : public CParameterOperate
11{
12 Q_OBJECT
13
14public:
15 explicit CStats(CParameterOperate* parent = nullptr,
16 const QString& szPrefix = QString());
17
18 [[nodiscard]] static QString Convertbytes(quint64 bytes);
19
20 QString TotalSends();
21 QString TotalReceives();
22 quint64 GetTotalSends();
23 quint64 GetTotalReceives();
24 virtual void AddSends(quint64 size);
25 virtual void AddReceives(quint64 size);
26
27 QString SendRate();
28 QString ReceiveRate();
33 [[nodiscard]] virtual double GetSendRate();
34 [[nodiscard]] virtual double GetReceiveRate();
35
39 [[nodiscard]] int GetInterval();
43 int SetInterval(int interval = 5);
44
45public Q_SLOTS:
46 virtual void slotCalculating();
47
48private:
49 QAtomicInteger<quint64> m_TotalSends;
50 QAtomicInteger<quint64> m_TotalReceives;
51 int m_tmInterval;
52 QDateTime m_lastTime;
53 QAtomicInteger<quint64> m_lastSends;
54 QAtomicInteger<quint64> m_lastReceives;
55 double m_dbSendRate;
56 double m_dbReceiveRate;
57
58 // CParameter interface
59protected:
60 virtual int OnLoad(QSettings &set) override;
61 virtual int OnSave(QSettings &set) override;
62};
操作参数接口。仅在插件内有效。
Definition Stats.h:11