1951FDG
10/16/2013 - 4:46 PM

Time code macro's

Time code macro's

#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);