Uint32 fps_lasttime = SDL_GetTicks(); //the last recorded time. Uint32 fps_current; //the current FPS. Uint32 fps_frames = 0; //frames passed since the last recorded fps. while (!quit) { if (update()) { fps_frames++; if (fps_lasttime < SDL_GetTicks() - 1000) { fps_lasttime = SDL_GetTicks(); fps_current = fps_frames; fps_frames = 0; } printf("Current FPS: %d\n", fps_current); } }