Due Date: October 5, 1995
Deliverables:
Two programs; man pages for both; a report. Source code
for the two programs, the two man pages, the report, and
the Makefile for the project are to be delivered in a
project directory whose pathname you will email to me when
the project is ready for grading.
The first program is a tool that can be used to determine
how long it takes:
To use a macro to increment an int variable.
To use a macro to increment a float variable.
To use a function to increment an int variable.
To use a function to increment a float variable.
Since these operations execute quickly, the program is to
take a command line argument that tells how many times
to perform each operation. It then does each operation
the required number of times and displays the time per
operation for each. The program will have to determine
the execution time for a loop that does nothing in order
to calculate the time required for the operations listed
above. Use the times() system call to determine the time
it takes to perform the computations.
The second program is much like the first, except that
it determines the time it takes to read bytes into
memory using the following algorithms:
Use fgetc() to read characters, one at a time.
Use read() to read characters, 1, 16, 256, 4096,
or 65536 bytes at a time.
Create a text file approximately 1 MB in size to use as
input for this program. This program is to give the
system and user times for each algorithm. The program
must take an optional command line argument that tells
the name of the data file to be read. If no command line
argument is given, the program is to use the value of
the environment variable TEST_FILE as the name of the
data file; if there is no command line argument and
and TEST_FILE is not set, the program should try to use
some default file name of your choosing. The program
is to display the name and size of the test file before
displaying the results of the program.
The man pages for these two programs are to have the same
names as the programs, with an extension of ".1" instead
of ".c" (be sure to use good "Unix-style" program names).
These man pages are to be formatted to look like read man
pages; they are to be plain ASCII text files.
The report is to be written as a research report containing
the following sections:
Introduction
Tell what questions the experiments were designed
to answer.
Method
Tell what experiments you did to answer the
questions described in the Introduction. Tell
what tools you used to do the experiments (the
two programs), but do not describe the internal
logic of the programs; just tell how they were
used.
Results
Tell what data you obtained. You should include
tables that summarize the data in an easy to
read format.
Conclusions
Tell what conclusions can be drawn from your
results about the time it takes to execute
macros, functions, and system calls.
NOTE: Each section, including the Results, is to be
written using complete, grammically correct
paragraphs. In the Results section your written material
is to guide the reader in understanding the tabular data;
some of the key data values might be mentioned, but do
not repeat all the values in the text.
Grading Criteria:
There is a standard grading form for projects in this
course, and there is an expanded copy that describes
details about the grading of this project in particular.
Follow the coding guidelines listed below for documenting
your programs.
Christopher Vickery
Queens College of CUNY