00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef MEMSENSOR_H
00011 #define MEMSENSOR_H
00012 #include "sensor.h"
00013 #include <tqglobal.h>
00014 #include <tqstring.h>
00015 #include <tqregexp.h>
00016 #include <kprocess.h>
00017
00018 #ifdef __FreeBSD__
00019 #include <kprocio.h>
00020 #include <kvm.h>
00021 #include <osreldate.h>
00022 #endif
00023
00024 class MemSensor : public Sensor
00025 {
00026 Q_OBJECT
00027 TQ_OBJECT
00028 public:
00029
00030 MemSensor( int interval );
00031 ~MemSensor();
00032
00033 int getMemTotal();
00034 int getMemFree();
00035 int getBuffers();
00036 int getCached();
00037
00038 int getSwapTotal();
00039 int getSwapFree();
00040
00041 void update();
00042 void setMaxValue( SensorParams *sp );
00043 TQString getMemLine();
00044
00045 private:
00046 TQString meminfo;
00047 void readValues();
00048 #if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
00049 int pageshift;
00050 TQString sensorResult;
00051 int swapTotal;
00052 int swapUsed;
00053 # if defined(Q_OS_FREEBSD) && defined(__FreeBSD_version) && __FreeBSD_version >= 500018
00054 kvm_t *kd;
00055 kvm_swap swapinfo;
00056 # elif defined(Q_OS_FREEBSD)
00057 KShellProcess ksp;
00058 bool MaxSet;
00059 # endif
00060 #endif
00061
00062 private slots:
00063 void receivedStdout(KProcess *, char *buffer, int);
00064 void processExited(KProcess *);
00065
00066 };
00067
00068 #endif // MEMSENSOR_H