Created
April 15, 2012 21:41
-
-
Save jeksys/2394945 to your computer and use it in GitHub Desktop.
timer debug 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
OTHER_CFLAGS = -DDEBUG=1 | |
#define MARK CMLog(@"%s", __PRETTY_FUNCTION__); | |
#define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); | |
CMLog(@"My iPhone is an %@, v %@", [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion]); | |
#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; | |
#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); | |
#if DEBUG==1 | |
#define CMLog(format, ...) NSLog(@"%s:%@", __PRETTY_FUNCTION__,[NSString stringWithFormat:format, ## __VA_ARGS__]); | |
#define MARK CMLog(@"%s", __PRETTY_FUNCTION__); | |
#define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; | |
#define END_TIMER(msg) NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]); | |
#else | |
#define CMLog(format, ...) | |
#define MARK | |
#define START_TIMER | |
#define END_TIMER(msg) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment