6#include <PhosphorShell/phosphorshell_export.h>
122 void restartBaseline();
124 QTimer* m_timer =
nullptr;
125 bool m_enabled =
true;
126 int m_interval = 2000;
127 int m_cpuPercent = 0;
128 int m_memoryPercent = 0;
133 bool m_haveCpuBaseline =
false;
137 bool m_warnedCpuRead =
false;
138 bool m_warnedCpuParse =
false;
139 bool m_warnedMemoryRead =
false;
140 bool m_warnedMemoryParse =
false;
void setInterval(int intervalMs)
void setEnabled(bool enabled)
Enabling re-baselines and samples immediately, so the first reading after a pause covers one interval...
SystemUsage(QObject *parent=nullptr)
int interval() const
Sampling period in milliseconds, clamped to at least MinIntervalMs.
static bool parseCpuTotals(const QByteArray &content, CpuTotals *out)
Parse the aggregate "cpu" line of a /proc/stat body.
static int cpuPercentBetween(const CpuTotals &prev, const CpuTotals ¤t)
Busy percentage between two cumulative snapshots, or -1 when the pair yields no usable rate: counters...
static constexpr int MinIntervalMs
Shortest accepted sampling period.
Definition SystemUsage.h:58
void memoryPercentChanged()
static bool parseMemoryTotals(const QByteArray &content, MemoryTotals *out)
Parse MemTotal / MemAvailable from a /proc/meminfo body.
int memoryPercent() const
Definition Environment.h:11
Cumulative busy / idle jiffies parsed from a /proc/stat body.
Definition SystemUsage.h:62
double idle
Definition SystemUsage.h:64
double total
Definition SystemUsage.h:63
Total / available kilobytes parsed from a /proc/meminfo body.
Definition SystemUsage.h:69
double availableKb
Definition SystemUsage.h:71
double totalKb
Definition SystemUsage.h:70