Obj-C FPS counter and dt time for iPhone

	// FPS
	static CFTimeInterval lastTime  = CFAbsoluteTimeGetCurrent();
	CFTimeInterval beginTime = CFAbsoluteTimeGetCurrent();
	CFTimeInterval dt        = beginTime - lastTime;

	static uint           FPS   = 0;
	static CFTimeInterval accum = 0;

	if ( accum >= 1.0 )
	{
		NSLog(@"%d", FPS);
		accum = 0.0;
		FPS   = 0;
	}
	else
	{
		FPS += 1;
	}

	accum   += dt;
	lastTime = beginTime;
This entry was posted in Graphics, iPad, iPhone, iPod, Programming. Bookmark the permalink.

Deja un comentario