Skip to content

Instantly share code, notes, and snippets.

@darkseed
Created May 11, 2011 22:39
Show Gist options
  • Save darkseed/967546 to your computer and use it in GitHub Desktop.
Save darkseed/967546 to your computer and use it in GitHub Desktop.
Objective-C Timer macros
#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; LPLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]);
// Example usage
- (void)loadStockCodeMaster
{
START_TIMER;
NSURL *url = [NSURL URLWithString:STOCK_CODE_MASTER_URL];
NSString *stringFile = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
END_TIMER(@"loadStockCodeMaster");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment