I am giving more detailed instructions for this example:
1. Download the stable version of the code.
2. Untar it.
3. Run the command: ./configure
4. Run the command: make
5. Run the command: make demos
6. Run the program shor as follows: ./shor 300
This should allow you to understand how to run the program and get the timing when using the optimization option "-O2" as this is the default in the default Makefile.
The following are the changes you need to do to get the output asked:
1. Change the Makefile CFLAGS option to not have the "-O2" option it currently has.
2. Once the command line arguments are parsed and before the actual program starts in shor.c, add a call to the function gettimeofday and add one more call to the same function at the end of the program before the print statements. Using the values from these two calls, you can compute the time taken for the program to run.
3. Repeat the above two steps with different options in CFLAGS for -O1, -O2 and -O3 and get the times.
As described earlier, try and run it multiple times and get an average of the results.
Submit a report on what your observations are. If there is no assignment for you to do in IT Lab, use the IT lab time to get this done as a good time management measure.