2009-11-05 18:18:51 +03:00
|
|
|
#ifndef __CPUMONITOR_H__
|
|
|
|
#define __CPUMONITOR_H__
|
|
|
|
|
|
|
|
#include <FL/Fl_Box.H>
|
2012-05-28 14:57:50 +04:00
|
|
|
#include "Applet.h"
|
2009-11-05 18:18:51 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
#ifdef HAVE_KSTAT_H
|
|
|
|
# include <kstat.h>
|
|
|
|
# include <sys/sysinfo.h>
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IWM_USER = 0,
|
|
|
|
IWM_NICE,
|
|
|
|
IWM_SYS,
|
|
|
|
IWM_IDLE,
|
|
|
|
IWM_STATES
|
|
|
|
};
|
|
|
|
|
2012-05-28 14:57:50 +04:00
|
|
|
EDE_PANEL_APPLET_CLASS(CPUMonitor, Fl_Box) {
|
2009-11-05 18:18:51 +03:00
|
|
|
private:
|
|
|
|
bool m_draw_label;
|
|
|
|
int m_old_samples;
|
|
|
|
int m_samples;
|
|
|
|
|
|
|
|
int **cpu;
|
|
|
|
long last_cpu[IWM_STATES];
|
|
|
|
Fl_Color colors[IWM_STATES];
|
|
|
|
|
|
|
|
public:
|
|
|
|
CPUMonitor();
|
|
|
|
~CPUMonitor() { clear(); }
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
void update_status();
|
|
|
|
void get_cpu_info();
|
|
|
|
|
|
|
|
void draw();
|
|
|
|
void layout();
|
2012-04-11 20:15:01 +04:00
|
|
|
int handle(int e);
|
2009-11-05 18:18:51 +03:00
|
|
|
|
|
|
|
int samples() const { return m_samples; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|