Skip to content

Instantly share code, notes, and snippets.

@adamkaplan
Last active August 29, 2015 14:16
Show Gist options
  • Save adamkaplan/67aacadbfc7dc904ed4e to your computer and use it in GitHub Desktop.
Save adamkaplan/67aacadbfc7dc904ed4e to your computer and use it in GitHub Desktop.
Xcode Timer Snippet.
Snippet Configuration: https://www.dropbox.com/s/n5c5wvkmmssihrb/Screenshot%202015-03-12%2015.57.17.png
{
uint64_t t_start = mach_absolute_time();
<#code#>
uint64_t t_end = mach_absolute_time();
struct mach_timebase_info t_info;
mach_timebase_info(&t_info);
double_t elapsed = (t_end - t_start) * t_info.numer / (t_info.denom * (double_t)1e6);
NSLog(@"Elapsed: %fms", elapsed);
}
@adamkaplan
Copy link
Author

  1. Paste the raw code into Xcode.
  2. Expand the "Utilities" pane (Shift Option Command 2)
  3. Highlight the code
  4. Drag the into the Snippets window
  5. Configure as desired. The image in the gist shows a full configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment