One Quickie


Cheap profiling (Unix API->General)
You can use gettimeofday() to get sub-second granularity for timing:
#include <sys/time.h>
struct timeval start, end;
...
gettimeofday (&start, NULL);

... the code you're timing

gettimeofday (&end, NULL);
double fstart, fend;
fstart = (start.tv_sec * 1000000.0 + start.tv_usec) / 1000000.0;
fend = (end.tv_sec * 1000000.0 + end.tv_usec) / 1000000.0;
NSLog (@"it took %f seconds", fend - fstart);



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com