Skip to content

Instantly share code, notes, and snippets.

@elpsk
Created June 22, 2015 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elpsk/ad5cd99efe63fd7e6a84 to your computer and use it in GitHub Desktop.
Save elpsk/ad5cd99efe63fd7e6a84 to your computer and use it in GitHub Desktop.
DEBUG Execution Time
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