we use something like ...
// Outside of main loop
unsigned int Frames = 0;
float FPS, Time;
sf::String FpsString;
sf::Clock Timer;
// inside main loop
Frames++;
Time = Timer.GetElapsedTime();
if (Time >= 2)
{
FPS = Frames / Time;
std::ostringstream os;
if(os << (int)FPS)
FpsString.SetText("FPS : " + os.str());
Timer.Reset();
Frames = 0;
}
this updates every 2sec to give a general idea of the average fps, lower/increase the 2 in the if statement if you want it to update faster/slower. Just stay away from the usual sprintf() solution to convert float to string, it's a bad one if you ask me.