summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendProc/SystemBackendProc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/SystemBackendProc/SystemBackendProc.h')
-rw-r--r--src/modules/SystemBackendProc/SystemBackendProc.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/SystemBackendProc/SystemBackendProc.h b/src/modules/SystemBackendProc/SystemBackendProc.h
index bf19e22..9b36df4 100644
--- a/src/modules/SystemBackendProc/SystemBackendProc.h
+++ b/src/modules/SystemBackendProc/SystemBackendProc.h
@@ -23,13 +23,14 @@
#include <Common/SystemBackend.h>
#include <fstream>
+#include <boost/noncopyable.hpp>
namespace Mad {
namespace Modules {
-class SystemBackendProc : private Common::SystemBackend {
+class SystemBackendProc : public Common::SystemBackend, boost::noncopyable {
private:
- static SystemBackendProc *backend;
+ static boost::shared_ptr<SystemBackendProc> backend;
std::ifstream uptimeFile;
std::ifstream meminfoFile;
@@ -38,16 +39,16 @@ class SystemBackendProc : private Common::SystemBackend {
SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
protected:
- virtual bool getUptimeInfo(const boost::function2<void, unsigned long, unsigned long> &callback);
- virtual bool getMemoryInfo(const boost::function4<void, unsigned long, unsigned long, unsigned long, unsigned long> &callback);
- virtual bool getLoadInfo(const boost::function5<void, unsigned long, unsigned long, float, float, float> &callback);
+ virtual bool getUptimeInfo(unsigned long *uptime, unsigned long *idleTime);
+ virtual bool getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap);
+ virtual bool getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15);
public:
static void registerBackend() {
if(backend)
return;
- backend = new SystemBackendProc();
+ backend.reset(new SystemBackendProc());
Common::SystemManager::get()->registerBackend(backend);
}
@@ -56,8 +57,7 @@ class SystemBackendProc : private Common::SystemBackend {
return;
Common::SystemManager::get()->unregisterBackend(backend);
- delete backend;
- backend = 0;
+ backend.reset();
}
};