Created
October 16, 2013 16:46
-
-
Save 1951FDG/2a278636ffe7c46774c8 to your computer and use it in GitHub Desktop.
Time code macro's
This file contains hidden or 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
#import <mach/mach_time.h> | |
#define startTimer(e) uint64_t e = mach_absolute_time(); | |
#define stopTimer(f, e, d) uint64_t f = mach_absolute_time(); printf("Total execution time for task named '%s': %g s\n", [d UTF8String], ((double)(f - e) / (double)NSEC_PER_SEC)); | |
startTimer(baba); | |
stopTimer(bab1, baba, @"myTimerName"); | |
#define JJLog(f, e, d) uint64_t f = mach_absolute_time(); printf("Total execution time for task named '%s': %llu ns\n", [d UTF8String], f - e); | |
#define JJLog(f, e) uint64_t f = mach_absolute_time(); printf("%s:%i %s:%llu\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, f - e); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment