summaryrefslogtreecommitdiffstats
path: root/src/Common/Backends/SystemBackendProc.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common/Backends/SystemBackendProc.h')
-rw-r--r--src/Common/Backends/SystemBackendProc.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Common/Backends/SystemBackendProc.h b/src/Common/Backends/SystemBackendProc.h
index 8caa080..619c996 100644
--- a/src/Common/Backends/SystemBackendProc.h
+++ b/src/Common/Backends/SystemBackendProc.h
@@ -30,6 +30,8 @@ namespace Backends {
class SystemBackendProc : public SystemBackend {
private:
+ static SystemBackendProc backend;
+
std::ifstream uptimeFile;
std::ifstream meminfoFile;
std::ifstream loadFile;
@@ -37,13 +39,17 @@ class SystemBackendProc : public SystemBackend {
SystemBackendProc() : uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {}
public:
- static void useBackend() {
- setBackend(std::auto_ptr<SystemBackend>(new SystemBackendProc()));
+ static void registerBackend() {
+ SystemBackend::registerBackend(&backend);
+ }
+
+ static void unregisterBackend() {
+ SystemBackend::unregisterBackend(&backend);
}
- virtual UptimeInfo getUptimeInfo();
- virtual MemoryInfo getMemoryInfo();
- virtual LoadInfo getLoadInfo();
+ virtual UptimeInfo uptimeInfo();
+ virtual MemoryInfo memoryInfo();
+ virtual LoadInfo loadInfo();
};
}