00001 00002 #ifndef CPU_STATS_H 00003 #define CPU_STATS_H 00004 00005 #include "common.h" 00006 #include "nmstl_util.h" 00007 00008 BOREALIS_NAMESPACE_BEGIN; 00009 00010 class CpuStats : public Thread { 00011 public: 00012 CpuStats(); 00013 00014 void terminate(); 00015 00019 double getCpuUsage() const { return _cpu_usage; } 00020 00021 private: 00022 void run(); 00023 00024 bool _die_cpu_stats; 00025 double _cpu_usage; 00026 static void getProcStats(int& total, int& idle); 00027 }; 00028 00029 BOREALIS_NAMESPACE_END; 00030 00031 #endif