In March, 2010, the Khronos group approved an extension to add timers to OpenGL. The version was 3.2. As of OpenGL 3.3 this functionality has become part of the specification.
As mention in the Very Simple Profile Library page, profiling is an essential technique to truly understand how to improve the performance of an application. Being able to get time measurements is important both in the development stage as well as during run-time after the application has been released. OpenGL Timer Queries allows us to profile the GPU. i.e. to determine the amount of time it takes to execute a command, or sequence of commands in the GPU.
A tutorial is available in here describing the OpenGL timer functions, showing how to use them, and describing a double buffer approach to prevent the application from being stalled while waiting for query results.