Timing
- The simple way to check wall-clock time:
date; my_program; date
- Checking CPU time consumed by the process:
time my_program
- Timing inside the code, by using
gettimeofday()
before
and after some interesting code chunk, and calculating the difference.
- Better perform the timing over many runs of the program/code-block, and
print the average.
- of even better, generate a log file and print a graph using gnuplot
or a spreadsheet.
Originally written by
guy keren