Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello Expert - Please Help, with output sample Exercise : Using linux, write a p

ID: 3695981 • Letter: H

Question

Hello Expert - Please Help, with output sample

Exercise : Using linux, write a program in C++ following information.

1. General information. In this section you will assemble some basic facts about the system

a. Machine name (hostname) # get this information from /proc/sys/kernel/hostname

b. System date and time # get this information from /proc/driver/rtc

c. Kernel version # get this information from /proc/version

d. Memory usage (used and free memory) # get this information from /proc/meminfo

2. Time information. In this section you will print out how long the system has been up and how busy it has been.

a. Duration of uptime # get these information from /proc/uptime

b. Duration of idletime

The skeleton of the program

(1) read file "/proc/uptime" to obtain Totaltime and Idletime

(2) read file "/proc/sys/kernel/hostname" to obtain the hostname

(3) read file "/proc/version" to obtain the kernel version

(4) read file "/proc/meminfo" to obtain the amount of used memory and free memory

(5) read file "/proc/driver/rtc" to obtain time and date

NOTE: Proper documentation and comments are required

Explanation / Answer

#include <iostream> // to work with cout
#include <fstream> // to work with files
#include <cstdlib> //to work with system() function
using namespace std;

// main function
int main()
{
// system() call to read Totaltime and Idletime from /proc/uptime
cout << " Here is the Totaltime and Idletime: " << endl;
system("cat /proc/uptime");

// system() call to read hostname from /proc/sys/kernel/hostname
cout << " Here is the hostname: " << endl;
system("cat /proc/sys/kernel/hostname");

// system() call to read kernel version from /proc/version
cout << " Here is the kernel version: " << endl;
system("cat /proc/version");

// system() call to read system memory info from /proc/meminfo
cout << " Here is the system memory info: " << endl;
system("cat /proc/meminfo");

// system() call to read time and date from /proc/driver/rtc
cout << " Here is the Time and Date: " << endl;
system("cat /proc/driver/rtc");

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote