You are on page 1of 1

CS 549: Performance Analysis of Computer Networks

Lab Assignment 2
Assigned: 10th April, 2020 Due: 11:55 pm, 14th April, 2020
1. Write a C program cpuhog.c that executes a while loop a large number of times. For
convenience, pass the number of iterations as a command-line argument. Measure the exe-
cution time in three ways: using the stopwatch function on your cellphone or wristwatch; us-
ing the time command; using the time() + getrusage() functions before/after the
while loop. Vary the number of executions of the while loop such that the execution times
range from a few milliseconds to one minute.
Compare the three methods of time measurement and explain any differences.
2. In this assignment, you will systematically conduct experiments to investigate the per-
formance of your laptop’s filesystem. Write a C program that reads a file using different
methods and measure the read throughput in B/s. Note: pseudo-code below is only illustrat-
ive.
a. One byte at a time: while (not eof) fgetc(inf)
b. One block at a time: while (not eof) fread(buf, size, 1, inf).
Try different values of size from 1 ... 100,000
Run the experiment for files of sizes 1 KB ... 100 MB.
Analyse and plot the read throughput, and explain the results.
Your submission to contain:
a. Statement of the problem
b. Design of the experiments: List the factors and the levels for each factor. List the
set of experiments that you plan to run. Each experiment is defined by the levels for
every factor.
c. Analysis and presentation of the data in the form of graphs and tables. Each graph/
table must have a paragraph explaining what it contains and your inferences.
d. Summary of your findings regarding filesystem performance. Compare your results
to the manufacturer’s data sheet for the disk drive in your laptop.
Optional:
a. Run R file readers in parallel and plot the performance as a function of R. Each
reader reads a different file, all files being of the same size.
b. Measure the write performance.
c. Measure the performance with mixed reads and writes.

You might also like