WAP to report behavior of the Linux Kernel including information on configured memory, amount of free and used memory (Memory information)

WAP to report behavior of the Linux Kernel including information on configured memory, amount of free and used memory (Memory information)
report behavior of the Linux Kernel

Write a Program(WAP) to report behavior of the Linux Kernel including information on configured memory, amount of free and used memory (Memory information)  

#include<iostream>
using namespace std;
#include<stdlib.h>
#include<stdio.h>
int main()
{
cout<<"\n The Kernel Version is : \n";
system("cat/proc/sys/kernel/osrelease");
cout<<"\n The CPU Space : \n";
system("cat/proc/cpuinfo | awk 'NR==3, NR==4{print}'\n");
cout<<"\n Amount of CPU time since system was last booted is : ";
system("cat/proc/uptime \n");
cout<<"\n The configured memory is :\n ";
system("cat/proc/meminfo | awk 'NR == 1{print $2}'\n");
cout<<"\n Amount of free memory :\n ";
system("cat/proc/meminfo | awk 'NR == 2{print $2}'\n");
cout<<"\n Amount of used memory is :\n ";
system("cat/proc/meminfo | awk '{if (NR==1) a=$2; if(NR==2) b=$2 }END {print a-b}' \n");
cout<<endl;
return 0;

}
WAP to report behavior of the Linux Kernel including information on configured memory, amount of free and used memory (Memory information)


About the author

Sarthak Mund S3
◕‿◕कर दिखाओ कुछ ऐसा की दुनिआ करना चाहे आपके जैसा◕‿◕

Post a Comment