Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages

CpuUsage.hpp

Go to the documentation of this file.
00001 
00002 #ifndef CpuUsage_HPP
00003 #define CpuUsage_HPP
00004 
00005 #include <pthread.h>
00006 #include <string>
00007 
00008 using namespace std;
00009 
00026    class CpuUsage{
00027 
00028       private:
00029 
00030 
00031 
00032       static const int CPU_MEASURE_INTERVAL = 10; 
00034       //TODO:Extracted variables from 2k. Don't have a clue about them :-)
00035       unsigned long us;
00036       unsigned long usLow;
00037       unsigned long sy;
00038       unsigned long id;
00039       unsigned long currTotal;
00040       unsigned long currUsed;
00041       unsigned long prevTotal;
00042       unsigned long prevUsed;
00043       double util;             
00045       double utilInInterval;   
00046       int numLoops;
00047 
00048       pthread_t thread;        
00049       pthread_mutex_t mutex;   
00055       void cpuLoop();
00056       
00060       static void * cpuLoopWrapper(void * ptr);
00061       
00062       static CpuUsage * singleInstance; 
00067       CpuUsage();
00068 
00069       public:
00070 
00071 
00072 
00073 
00074 
00081        float utilization();
00082        
00086        static CpuUsage & getInstance();
00087 };
00088 
00089 #endif//CpuUsage_HPP
00090 

Generated on Mon Sep 6 16:12:47 2004 by doxygen 1.3.3