Created
June 22, 2015 10:26
-
-
Save elpsk/ad5cd99efe63fd7e6a84 to your computer and use it in GitHub Desktop.
DEBUG Execution Time
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
NSDate *_start; | |
- (void) start | |
{ | |
_start = [NSDate date]; | |
} | |
- (void) stopMethod:(NSString*)pMethod line:(int)pLine | |
{ | |
NSTimeInterval timeInterval = [_start timeIntervalSinceNow]; | |
APLog(@"[APL] + %s:%d ---> %.3f.", [pMethod cStringUsingEncoding:NSUTF8StringEncoding], pLine, fabs(timeInterval) ); | |
} | |
- (void) start:(NSString*)pMethod line:(int)pLine completion:(void (^)(BOOL *finished))completion | |
{ | |
[self start]; | |
BOOL stop = NO; | |
completion( &stop ); | |
if ( stop ) | |
{ | |
[self stopMethod:pMethod line:pLine]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment