/* * SystemBackendProc.h * * Copyright (C) 2008 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with this program. If not, see . */ #ifndef MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_ #define MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_ #include #include #include namespace Mad { namespace Modules { namespace SystemBackendProc { class SystemBackendProc : public Common::SystemBackend { private: Common::Application *application; std::ifstream uptimeFile; std::ifstream meminfoFile; std::ifstream loadFile; protected: virtual void getUptimeInfo(unsigned long *uptime, unsigned long *idleTime) throw(Core::Exception); virtual void getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap) throw(Core::Exception); virtual void getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15) throw(Core::Exception); public: SystemBackendProc(Common::Application *application0) : application(application0), uptimeFile("/proc/uptime"), meminfoFile("/proc/meminfo"), loadFile("/proc/loadavg") {} }; } } } #endif /* MAD_MODULES_SYSTEMBACKENDPROC_SYSTEMBACKENDPROC_H_ */