-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save profiling of intersect+adj code
- Loading branch information
1 parent
29270ea
commit ad39e54
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef TIMER_H | ||
#define TIMER_H | ||
|
||
|
||
#include <stdio.h> | ||
#include "mach/mach_time.h" | ||
|
||
|
||
uint64_t timestamp() { | ||
return mach_absolute_time(); | ||
} | ||
|
||
|
||
void print_elapsed(uint64_t elapsed, const char *msg) { | ||
mach_timebase_info_data_t info; | ||
mach_timebase_info(&info); | ||
double nanos = elapsed * ((double)(info.numer) / (double)(info.denom)); | ||
if (nanos > 1000000000) { | ||
printf("%s Elapsed time: %lf s\n", msg, nanos / 1000000000.0); | ||
} else if (nanos > 1000000) { | ||
printf("%s Elapsed time: %lf ms\n", msg, nanos / 1000000.0); | ||
} else { | ||
printf("%s Elapsed time: %lf ns\n", msg, nanos); | ||
} | ||
} | ||
|
||
|
||
#endif // TIMER_H |
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