#include #include using namespace std; unsigned long total_ram() { struct sysinfo si; sysinfo (&si); return( si.totalram ) ; } unsigned long free_ram() { struct sysinfo si; sysinfo (&si); return( si.freeram ) ; } unsigned long shared_ram() { struct sysinfo si; sysinfo (&si); return( si.sharedram ) ; } unsigned long buffer_ram() { struct sysinfo si; sysinfo (&si); return( si.bufferram ) ; } unsigned long total_swap() { struct sysinfo si; sysinfo (&si); return( si.totalswap ) ; } unsigned long free_swap() { struct sysinfo si; sysinfo (&si); return( si.freeswap ) ; } unsigned long total_high() { struct sysinfo si; sysinfo (&si); return( si.totalhigh ) ; } unsigned long free_high() { struct sysinfo si; sysinfo (&si); return( si.freehigh ) ; } int main() { cout.imbue(std::locale("")); cout << " total_ram " ; cout.width(18) ; cout << total_ram() << endl ; cout << " free_ram " ; cout.width(18) ; cout << free_ram() << endl ; cout << " shared_ram " ; cout.width(18) ; cout << shared_ram() << endl ; cout << " buffer_ram " ; cout.width(18) ; cout << buffer_ram() << endl ; cout << " total_swap " ; cout.width(18) ; cout << total_swap() << endl ; cout << " free_swap " ; cout.width(18) ; cout << free_swap() << endl ; cout << " total_high " ; cout.width(18) ; cout << total_high() << endl ; cout << " free_high " ; cout.width(18) ; cout << free_high() << endl ; return(0); }