CCIMXDesktop
 
Loading...
Searching...
No Matches
CPUUsageChart.h
1#ifndef CPUUSAGECHART_H
2#define CPUUSAGECHART_H
3#include "Core/CPUStateFetcher.h"
4#include <QWidget>
5class QChart;
6class QLineSeries;
7class QValueAxis;
8
9namespace Ui {
10class CPUUsageChart;
11}
12
17class CPUUsageChart : public QWidget {
18 Q_OBJECT
19
20public:
26 explicit CPUUsageChart(QWidget* parent = nullptr);
32
33public slots:
40
41private:
42 static constexpr const unsigned short MAX_POINT { 30 };
43 void setup_chart_ui();
44 void flush_labels(const CPUStateFetcher::CPUState& state, const double cpu_usage_percentage);
45 Ui::CPUUsageChart* ui;
46 QChart* chart { nullptr };
47 QLineSeries* series { nullptr };
48 QValueAxis* axisX { nullptr };
49 QValueAxis* axisY { nullptr };
50 QList<int> xValues;
51 QList<double> yValues;
52 int currentTime = 0;
53 struct {
54 double last_tol { 0.0 };
55 double last_idle { 0.0 };
56 } cached_data;
57};
58
59#endif // CPUUSAGECHART_H
The CPUUsageChart class The CPU UsageChart class provides the CPU usage chart displaying.
Definition CPUUsageChart.h:17
~CPUUsageChart()
Destroy the CPUUsageChart object.
Definition CPUUsageChart.cpp:36
void flush_from_cpudriver(const CPUStateFetcher::CPUState &state)
flush_from_cpudriver
Definition CPUUsageChart.cpp:6
double last_idle
last idle time
Definition CPUUsageChart.h:55
double last_tol
last total time
Definition CPUUsageChart.h:54
The CPUState struct Represents CPU usage state including idle, user, kernel and total time....
Definition CPUStateFetcher.h:33