previous | start | next

## Profiling the Selection Sort Algorithm

- To measure the performance of a program, one could simply run it and measure how long it takes by using a stopwatch.
- Recall that default construction for the `Time` class initializes the object to the current time.

  >     Time now

- We can use `Time` objects to measure the performance of the sorting algorithm.

  >     Time before;
  >     selection_sort(v);
  >     Time after;

  >     cout << "Elapsed time = " << after.seconds_from(before)
  >        << " seconds\n";

previous | start | next