Created
May 11, 2011 22:39
-
-
Save darkseed/967546 to your computer and use it in GitHub Desktop.
Objective-C Timer macros
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
#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