Created
January 14, 2014 13:13
-
-
Save leviathan/8418102 to your computer and use it in GitHub Desktop.
UIKit Benchmarking Drawing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(refresh:)]; | |
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; | |
counter = 0; | |
previousTimestamp = displayLink.timestamp; | |
- (void)refresh:(CADisplayLink *)displayLink { | |
counter++; | |
if (counter > 60) { | |
CGFloat timePerFrame = (displayLink.timestamp - previousTimestamp) / 60.0; | |
NSLog(@"Time per frame: %f", timePerFrame); | |
previousTimestamp = displayLink.timestamp; | |
counter = 0; | |
} | |
[self bringTheViewOnScreen]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment