A friend of mine recently participated in a mountain bike race in Colorado. His 18-mile ride was completely tracked by the Strava Cycling - GPS Biking and Riding Route Tracker (free).
Your iPhone works as the GPS device. Go out for a ride and then view your activities on Strava.com.
As you can see on the image above, it took my friend less than 2 hours to complete the 18 mile race, climbing 1,500 feet in elevation (already starting at 6,900 feet!).