Created
October 1, 2011 06:10
-
-
Save kimhunter/1255672 to your computer and use it in GitHub Desktop.
objective-c code inline code block profiling
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 KMProfile(MSG, CODE_TO_PROFILE) { \ | |
NSDate *KMStartDate = [NSDate date]; \ | |
NSTimeInterval KMduration; \ | |
CODE_TO_PROFILE \ | |
KMduration = [[NSDate date] timeIntervalSinceDate:KMStartDate]; \ | |
NSLog(@"KMProfile: %@ TOOK %.0lfms (%.1lfs) ", MSG,(KMduration*1000) , KMduration); \ | |
} | |
// Usage: (works well with something a bit more intensive but you get the gist) | |
KMProfile(@"test printf ", { | |
printf("%d", 452); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment