Advertise here

Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Frame Rate Limiter and Counter

CaptainRedmuffCaptainRedmuff Posts: 75Registered Users
edited September 2008 in iOS SDK Development
Hi guys,

I'm having troubles calculating the frame rate from my app. I've used NSDate and timeIntervalSinceDate but just seem to be getting errors which seem fairly trivial, but just wont work as all the examples i've seen.

The code i've been using is:
NSDate *startDate = [NSDate date];

//rendering etc in here

NSDate *endDate = [NSDate date];

NSLog(@"Time elapsed: %f", [endDate timeIntervalSinceDate:startDate]);

This just seems to throw errors and crash my app. I've seen these lines in many examples, but don't understand why i'm not getting any real values. The one time i did manage to get it working, the onyl value returned was 0.0.

Ideally, i want to check to see when a certain time interval has passed, most likely every 1/10th of a second, but currently, any value will do as long as i can see it working. I'd like to use this to limit my logic in my app without having to update everything as it is being rendered and also to maintain a persistent rate of performance.

Has anyone else had any trouble with this, or come across a better method of calculating the frame rate of an app? Any help would be greatly appreciated.
Post edited by CaptainRedmuff on


Sign In or Register to comment.