File: cpuplot.h

package info (click to toggle)
libqwt 4.2.0-4.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 9,832 kB
  • ctags: 5,512
  • sloc: cpp: 22,973; ansic: 244; makefile: 66
file content (44 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <qwt_plot.h>
#include "cpustat.h"

#define HISTORY 60 // seconds

class CpuPlot : public QwtPlot 
{
    Q_OBJECT
public:
    enum CpuData
    {
        User,
        System,
        Total,
        Idle,
        Average,

        NCpuData
    };

    CpuPlot(QWidget * = 0);
    const QwtPlotCurve *cpuCurve(int id) const
        { return curve(data[id].curve); }

protected:
    virtual void drawCanvasItems(QPainter *, const QRect &,
        const QwtArray<QwtDiMap> &, const QwtPlotPrintFilter &) const;

    void timerEvent(QTimerEvent *e);

private slots:
    void toggleCurve(long);

private:
    struct
    {
        long curve;
        double data[HISTORY];
    } data[NCpuData];
    double timeData[HISTORY];

    int dataCount;
    CpuStat cpuStat;
};