Created
October 28, 2011 13:58
-
-
Save blladnar/1322331 to your computer and use it in GitHub Desktop.
Stopwatch for timing stuff
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
#import <mach/mach_time.h> | |
#define StopWatchStart() uint64_t startTime = mach_absolute_time() | |
#define StopWatchEnd(caption) uint64_t elapsed = mach_absolute_time() - startTime; static mach_timebase_info_data_t sTimebaseInfo; if ( sTimebaseInfo.denom == 0 ) { (void) mach_timebase_info(&sTimebaseInfo); } uint64_t elapsedNano = elapsed * sTimebaseInfo.numer / sTimebaseInfo.denom / 1000000; DLog(@"%s: %qu ms\n", caption, elapsedNano) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment