CPU type and model
Kernel version
Amount of time since the system was last booted in the form dd:hh:mm:ss
Report date and machine hostname (hostname would be athena)

The amount of time the CPU has spent in user mode, system mode and idle
The number of disk requests made on the system
The number of context switches that the kernel has performed
The time when the system was last booted

The amount of memory configured into this computer
The amount of memory currently available
A list of load averages (each averaged over last minute) - this information will allow another program to plot these values against time so that a user can see how the load average varied over some time interval. Allow the user to specify how the load average is sampled. To do this we will need additional parameters: one to indicate how often the load average should be read from the kernel; one to indicate the time interval over which the load average should be read.

The first version (A) can be called by ‘observer’, the second (B) by ‘observer -s’ , third (C) ‘observer -1 2 60’, where the load average observation would run for 60 seconds, sampling the kernel table about once every 2 seconds

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

// hw1.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/utsname.h>

void sampleLoadAvg(char *repTypeName){
    struct timeval now;
    gettimeofday(&now, NULL);
    printf ("Status report type %s at %s\n", repTypeName, ctime(&(now.tv_sec)));

    printf("\n%s\n", "Processor Type: ");
    system("uname -p");

    printf("\n%s\n", "Processor Model: ");
    system("uname -m");

    printf("%s\n", "Kernel Name: ");
    system("uname -v");

    printf("\n%s\n", "Last Booted on (dd:hh:mm:ss): ");
    system("who -b | awk '{ print $4 \":\" $5 }'");

    printf("\n%s\n", "Date: ");

    char hostName[1024];
    hostName[1023] = '\0';
    gethostname(hostName, sizeof(hostName));
    printf("\n%s %s\n", "Host Name:", hostName);

int main(int args, char *argv[]){
    char repType...
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats