00001 00002 #ifndef __PLOT_H__ 00003 #define __PLOT_H__ 00004 00005 #include <QtCore/QDebug> 00006 #include <QtCore/QTimer> 00007 #include <QtCore/QTimerEvent> 00008 00009 #include <glibtop.h> 00010 #include <glibtop/cpu.h> 00011 00012 static const unsigned NUM_POINTS = 60 + 1; 00013 enum 00014 { 00015 CPU_TOTAL, 00016 CPU_USED, 00017 N_CPU_STATES 00018 }; 00019 class Plot 00020 { 00021 private: 00022 guint n; 00023 struct 00024 { 00025 guint now; 00026 guint64 times[2][GLIBTOP_NCPU][N_CPU_STATES]; 00027 } cpu; 00028 float data[NUM_POINTS]; 00029 public: 00030 Plot(); 00031 ~Plot(); 00032 void get_load(); 00033 00034 }; 00035 00036 #endif // __PLOT_H__ 00037