cpusensor.h
00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Hans Karlsson * 00003 * karlsson.h@home.se * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 #ifndef CPUSENSOR_H 00011 #define CPUSENSOR_H 00012 #include "sensor.h" 00013 00014 #include <tqfile.h> 00015 #include <tqregexp.h> 00016 00017 class CPUSensor : public Sensor 00018 { 00019 Q_OBJECT 00020 00021 public: 00022 CPUSensor( TQString cpuNbr, int interval ); 00023 ~CPUSensor(); 00024 void update(); 00025 void setMaxValue( SensorParams *sp ); 00026 00027 int getCPULoad(); 00028 00029 private: 00030 long userTicks; 00031 long sysTicks; 00032 long niceTicks; 00033 long idleTicks; 00034 00035 int user; 00036 int system; 00037 int nice; 00038 int idle; 00039 00040 void getTicks (long &u,long &s,long &n,long &i); 00041 TQString cpuNbr; 00042 00043 }; 00044 00045 #endif // CPUSENSOR_H