## Due Date: In class

In this in-class assignment you will use the `gprof` tool to profile a program you will download from the course website. You will need to use your laptop with the virtual machine you are using for the course assignments, and it will be helpful to have a printout or access to the slides from the profiling lecture. Please read and follow these instructions carefully, and turn in the answers to questions asked below the the professor at the end of lecture.

2. Change to a directory where you will work:
``` % cd ~/tmp ```
3. Untar the file using the tar command, change to the newly created directory:
``` % tar xvzf cmpsc311-profile-inclass.tgz % cd cmpsc311-inclass-profile ```
4. Build the program using the Makefile and `make` utility.
``` % make ```
5. Run the program and provide the first 10 characters of your first and last name as the sole input parameter (repeat the names if this is less than 10 characters). For example, if I were to run it, I would be run as follows:
``` % ./profileme patrickmcd ```
6. Run the gprof tool and look at the performance recorded.
7. Write down the top 3 functions in terms of total run time, and record the percentage of total execution time for the program.
 # Function Percent of Execution Time Total Function Execution Time (seconds) 1 2 3
8. Record the 3 functions called the most during the entire program run.
 # Function Number of Calls 1 2 3
9. Now run the program 5 more times using the following input and record the function that is takes up the most execution time, and record the total program execution time.
 Input Function Percent of Execution Time Total Function Execution Time (seconds) Total Program Execution Time (seconds) pennstates bbcdefgccc aaaaaaaaaa fghkpvzpvz iowaboring
10. Based on the results of the previous question, which function is the best candidate for optimization and why?
 Function:
11. Using Amdahl's law, calculate the expected speed up of the program if the function identified in the previous question had a run-time of zero seconds (on input "pennstates").

 Speed up =
12. Edit file profileme.c and edit the function identified in the previous question. Comment out the while loop. Save and make the program.

13. Re-run the program with the input "iowaboring". Does the performance match the run-time predicted by Amdahl's law? Why are why not?

 A: