The goal of this assignment is to get everyone up to speed on system programming, to use man, to get familiar with system types, and to gain some familiarity with the system call interface. A secondary goal is to use some of the programming tools provided in the Unix environment.
In this assignment, you are to implement a timer program that times other programs. It will be called like this:
mytime foo a b c
where "foo" is the name of a program and "a b c" are the parameters to foo.
To implement your program, you will need to use two system calls, gettimeofday() and system().
gettimeofday() returns the current time.
system() takes a string containing a command and executes that command.
Your program should calculate the amount of time it takes for the called program (foo in the example above) to run.
Once you have your program running, time three programs: du, ls, and ps (read
the man pages for these programs if you are unfamiliar with them). Record the
times and report them in a separate document called Output. In that document,
speculate on the reasons for the differences in the times that the three programs
take to execute.
REMEMBER: Do not submit object files, assembler files, or executables. Every file in the submit directory that could be generated automatically by the compiler or assembler will result in a deduction from your programming assignment grade.
sbrandt@cse.ucsc.edu |