//------in init function
GLuint timerObject;
glGenQueries(1,&timerObject);
//-----------------
glBeginQuery(GL_TIME_ELAPSED,timerObject);
fbo->Bind();
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
fbo->AttachTexture(GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, clear_texture );
glClear(GL_COLOR_BUFFER_BIT);
glEndQuery(GL_TIME_ELAPSED);
GLint available = 0;
while (!available) {
glGetQueryObjectiv(timerObject, GL_QUERY_RESULT_AVAILABLE, &available);
}
GLuint64 timeElapsed; //time elapsed in nanosecond
glGetQueryObjectui64v(timerObject,GL_QUERY_RESULT,&timeElapsed);
//print timeElapsed